jaxx.runtime
Class PropertyDecorator<O>

java.lang.Object
  extended by jaxx.runtime.Decorator<O>
      extended by jaxx.runtime.PropertyDecorator<O>
Type Parameters:
O - type of decorated objects
All Implemented Interfaces:
java.io.Serializable

public class PropertyDecorator<O>
extends Decorator<O>

Simple property decorator based on String.format(String, Object[]) method.

To use it, give him a class and the property name to render.

For example :

 Decorator<Object> d = PropertyDecorator.newDecorator(PropertyDecorator.class,"expressions");
 

Author:
chemit
See Also:
Decorator, Serialized Form

Field Summary
protected  java.lang.reflect.Method m
           
protected  java.lang.String property
           
 
Fields inherited from class jaxx.runtime.Decorator
internalClass
 
Constructor Summary
protected PropertyDecorator(java.lang.Class<O> internalClass, java.lang.String property)
           
 
Method Summary
protected  java.lang.reflect.Method getM()
           
 java.lang.String getProperty()
           
static
<O> PropertyDecorator<O>
newDecorator(java.lang.Class<O> internalClass, java.lang.String property)
          Factory method to instanciate a new PropertyDecorator for the given class O and a readable property name.
 java.lang.String toString(java.lang.Object bean)
           
 
Methods inherited from class jaxx.runtime.Decorator
getInternalClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

property

protected java.lang.String property

m

protected transient java.lang.reflect.Method m
Constructor Detail

PropertyDecorator

protected PropertyDecorator(java.lang.Class<O> internalClass,
                            java.lang.String property)
                     throws java.lang.NullPointerException
Throws:
java.lang.NullPointerException
Method Detail

newDecorator

public static <O> PropertyDecorator<O> newDecorator(java.lang.Class<O> internalClass,
                                                    java.lang.String property)
                                         throws java.lang.IllegalArgumentException,
                                                java.lang.NullPointerException
Factory method to instanciate a new PropertyDecorator for the given class O and a readable property name.

Type Parameters:
O - the generic type of class to be decorated by the new decorator
Parameters:
internalClass - the class of the objects decorated by the new decorator
property - the property
Returns:
the new instanciated decorator
Throws:
java.lang.IllegalArgumentException - if the expression is not valid, says:

- a missing right brace was detected.

- a ${ was found in a jxpath token.

java.lang.NullPointerException - if internalClass parameter is null.

toString

public java.lang.String toString(java.lang.Object bean)
Specified by:
toString in class Decorator<O>
Parameters:
bean - the bean to decorate
Returns:
the string value of the given bean

getProperty

public java.lang.String getProperty()

getM

protected java.lang.reflect.Method getM()


Copyright © 2008-2009 CodeLutin. All Rights Reserved.