org.jicengine.operation
Class BeanUtils

java.lang.Object
  extended byorg.jicengine.operation.ReflectionUtils
      extended byorg.jicengine.operation.BeanUtils

public class BeanUtils
extends ReflectionUtils

Utilities for manipulating beans through reflection.

Author:
.timo

Nested Class Summary
 
Nested classes inherited from class org.jicengine.operation.ReflectionUtils
ReflectionUtils.NoMethodWithSuchParametersException, ReflectionUtils.NoSuchConstructorException, ReflectionUtils.NoSuchMethodException
 
Constructor Summary
BeanUtils()
           
 
Method Summary
static java.lang.Object getProperty(java.lang.Object instance, java.lang.String propertyName)
          Returns the value of a property.
static void setProperty(java.lang.Object instance, java.lang.String propertyName, java.lang.Object value)
          Sets the value of a property.
static java.lang.String toGetterMethodName(java.lang.String property)
          Transforms a property-name to a corresponding getter-method name.
static java.lang.String toSetterMethodName(java.lang.String property)
          Transforms a property-name to a corresponding setter-method name.
 
Methods inherited from class org.jicengine.operation.ReflectionUtils
formatParameters, getActorClass, getFieldValue, getTypes, instantiate, invokeMethod, invokeStaticMethod, primitiveTypeToWrapperType, primitiveWrapperToPrimitiveType, setFieldValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanUtils

public BeanUtils()
Method Detail

setProperty

public static void setProperty(java.lang.Object instance,
                               java.lang.String propertyName,
                               java.lang.Object value)
                        throws java.lang.NoSuchMethodException,
                               java.lang.IllegalAccessException,
                               java.lang.IllegalArgumentException,
                               java.lang.reflect.InvocationTargetException
Sets the value of a property.

Parameters:
instance - the instance whose property is set.
propertyName - the name of the property to be set.
value - the new value of the property.
Throws:
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException

toGetterMethodName

public static java.lang.String toGetterMethodName(java.lang.String property)
Transforms a property-name to a corresponding getter-method name. for example 'name' -> 'getName'


toSetterMethodName

public static java.lang.String toSetterMethodName(java.lang.String property)
Transforms a property-name to a corresponding setter-method name. for example 'name' -> 'setName'


getProperty

public static java.lang.Object getProperty(java.lang.Object instance,
                                           java.lang.String propertyName)
                                    throws java.lang.NoSuchMethodException,
                                           java.lang.reflect.InvocationTargetException,
                                           java.lang.IllegalAccessException
Returns the value of a property. throws NoSuchMethodException if the property doesn't exist.

Throws:
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException