Class PropertySetter

  • All Implemented Interfaces:
    ContextAware

    public class PropertySetter
    extends ContextAwareBase
    General purpose Object property setter. Clients repeatedly invokes setProperty(name,value) in order to invoke setters on the Object specified in the constructor. This class relies on reflection to analyze the given Object Class.

    Usage:

     PropertySetter ps = new PropertySetter(anObject);
     ps.set("name", "Joe");
     ps.set("age", "32");
     ps.set("isMale", "true");
     

    will cause the invocations anObject.setName("Joe"), anObject.setAge(32), and setMale(true) if such methods exist with those signatures. Otherwise an PropertySetterException is thrown.

    Author:
    Anders Kristensen, Ceki Gulcu