How to write a configurable Java variable creation
<p>A new java component that is suppose to send along a list of pre-define variable to external party. User will then able to define which variable (a fixed set of variable) they want to send via a xml property file</p>

<p>Problem is: The pre-define variable is inside a class, and have business logic together with it, which i can't change or tap into (part of external api). eg as follow:</p>

<pre><code>public class DataColumn implement java.io.Serializable{
    public static final String _actionID = "ActionID";
    public static final String _actionName = "ActionName";
    public static final String _actionDesc = "ActionDescription";
    public static final DataColumn ActionDesc = new DataColumn (_actionDesc);
    public static final DataColumn ActionID = new DataColumn (_actionID);
    public static final DataColumn ActionName = new DataColumn (_actionName);

    ....and about 100 other variale more

    protected WebMediaReportColumn(java.lang.String value) {
       _value_ = value;
       _table_.put(_value_,this);
    } 
}
</code></pre>

<p>user will define in the xml file like following:</p>

<pre><code>&lt;interface&gt;
    &lt;fields isRequired="true"&gt;
        &lt;field&gt;ActionID&lt;/field&gt;
        &lt;field&gt;ActionName&lt;/field&gt;
        &lt;field&gt;ActionDescription&lt;/field&gt;
     &lt;/fields&gt;
&lt;/interface&gt;
</code></pre>

<p>In order to set which variable to send across, the code looks like following:</p>

<pre><code>interface.setColumns(new DataColumn[] { 
    DataColumn.ActionID, DataColumn.ActionName, DataColumn.ActionDesc
    }
);
</code></pre>

<p>Question is: how best to write a program that can base on what the user define in a property file, and create the Datacolumn[] Array accordingly?  <strong>Without</strong> using If else block which is too long and hard to maintain.</p>
