edu.cmu.minorthird.util
Class RefUtils

java.lang.Object
  extended by edu.cmu.minorthird.util.RefUtils

public class RefUtils
extends java.lang.Object

Utilities for reflection.


Constructor Summary
RefUtils()
           
 
Method Summary
static java.lang.Object modify(java.lang.Object obj, java.lang.String modifications)
          Returns a modified copy of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RefUtils

public RefUtils()
Method Detail

modify

public static java.lang.Object modify(java.lang.Object obj,
                                      java.lang.String modifications)
Returns a modified copy of the object.

Parameters:
modifications - a comma or semi-colon separated list of strings of the form LHS=RHS, where RHS is something that can be passed to toObject(), and LHS is a period-separated chain of getters/setters, where only the last item is a setter.

Example:
RefUtils.modify( new StackedSequenceLearner(new MaxEntLearner(),1),
"params.historySize=1,params.futureSize=0")
is the same as: StackedSequenceLearner a = new StackedSequenceLearner(new MaxEntLearner(),1);
a.getParams().setHistorySize(1);
a.getParams().setFutureSize(0);