net.sf.freecol.common.util
Class Introspector

java.lang.Object
  extended by net.sf.freecol.common.util.Introspector

public class Introspector
extends java.lang.Object

A class to allow access to the methods "fooType getFoo()" and "void setFoo(fooType)" conventionally seen in objects. Useful when Foo arrives as a run-time String, such as is the case in serialization to/from XML representations.


Constructor Summary
Introspector(java.lang.Class<?> theClass, java.lang.String field)
          Build a new Introspector for the specified class and field name.
 
Method Summary
 java.lang.String getter(java.lang.Object obj)
          Invoke the get-method for this Introspector.
 void setter(java.lang.Object obj, java.lang.String value)
          Invoke the set-method provided by this Introspector.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Introspector

public Introspector(java.lang.Class<?> theClass,
                    java.lang.String field)
             throws java.lang.IllegalArgumentException
Build a new Introspector for the specified class and field name.

Parameters:
theClass - The Class of interest.
field - The field name within the class of interest.
Throws:
java.lang.IllegalArgumentException
Method Detail

getter

public java.lang.String getter(java.lang.Object obj)
                        throws java.lang.IllegalArgumentException
Invoke the get-method for this Introspector.

Parameters:
obj - An Object (really of type theClass) whose get-method is to be invoked.
Returns:
A String containing the result of invoking the get-method.
Throws:
java.lang.IllegalArgumentException

setter

public void setter(java.lang.Object obj,
                   java.lang.String value)
            throws java.lang.IllegalArgumentException
Invoke the set-method provided by this Introspector.

Parameters:
obj - An Object (really of type theClass) whose set-method is to be invoked.
value - A String containing the value to be set.
Throws:
java.lang.IllegalArgumentException