Creating objects from a string
<p>I know if I were in <code>PHP</code> I would be able to create an object as following:</p>

<pre><code>// class Name
$var = "Name";
$my_name = new $var("John", "Doe");
</code></pre>

<p>Now, I wanted to adopt similar approach in <code>Java</code>. I have a file which I need to parse and produce objects depending on the line read from the file. For example:</p>

<pre><code>2235:org.powertac.common.TariffSpecification::8::addRate::9
2235:org.powertac.common.Tariff::8::new::8
2235:org.powertac.common.TariffSpecification::10::new::1::PRODUCTION
2236:org.powertac.common.Rate::11::new
2236:org.powertac.common.Rate::11::withValue::0.015
2236:org.powertac.common.Rate::11::setTariffId::10
2236:org.powertac.common.TariffSpecification::10::addRate::11
2236:org.powertac.common.Tariff::10::new::10
2247:org.powertac.common.RandomSeed::12::init::DistributionUtilityService::0::model::-7651755067434358
2257:org.powertac.genco.Genco::13::new::nsp1a::true::true
2258:org.powertac.genco.Genco::13::new::nsp1a
2258:org.powertac.genco.Genco::15::new::nsp1b::true::true
</code></pre>

<p>then I should create an object of the type <code>Rate</code>, (<code>new</code>), with default values.
Therefore, parsing that line would yield me:
<code>"org.powertac.common.Rate"</code>(<code>String</code>) and I wanted to create a <code>org.powertac.common.Rate</code> object. How could I do it? I know it's a lazy evaluation ... how can I create something similar in <code>Java</code>?</p>
