org.reflexiveframework.proxy
Class Reflexive

java.lang.Object
  extended by org.reflexiveframework.proxy.Reflexive
All Implemented Interfaces:
net.sf.cglib.proxy.Callback, net.sf.cglib.proxy.MethodInterceptor

public class Reflexive
extends java.lang.Object
implements net.sf.cglib.proxy.MethodInterceptor

Reflexive provides a clean way to handle string literals, by dynamically resolving properties. Create a control object by invoking create. Only use with control objects. Usage with normal objects is unsupported.

Author:
Andries Inze

Method Summary
static java.lang.Object create(java.lang.Class clazz)
          Creates a new control object.
 java.lang.Object intercept(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object[] args, net.sf.cglib.proxy.MethodProxy methodProxy)
           
static java.lang.String resolveNestedPropertyName(boolean value)
           
static java.lang.String resolveNestedPropertyName(double value)
           
static java.lang.String resolveNestedPropertyName(long value)
           
static java.lang.String resolveNestedPropertyName(java.lang.Object object)
          Resolves the property from the method that was invoked.
static java.lang.String resolvePropertyName(boolean number)
           
static java.lang.String resolvePropertyName(double number)
           
static java.lang.String resolvePropertyName(long number)
           
static java.lang.String resolvePropertyName(java.lang.Object object)
          Resolves the property from the method that was invoked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static java.lang.Object create(java.lang.Class clazz)
Creates a new control object.

Parameters:
clazz -
Returns:

resolvePropertyName

public static java.lang.String resolvePropertyName(java.lang.Object object)
Resolves the property from the method that was invoked. Usage: Reflexive.resolvePropertyName(myObject.getMyProperty()) This would return myProperty Only get- and is-methods are supported.

Parameters:
object - The returned object after invoking the created reflexive object
Returns:
the resolved propertyName

resolvePropertyName

public static java.lang.String resolvePropertyName(long number)
Parameters:
number - the number to process
Returns:
the resolved propertyName
See Also:
resolvePropertyName(Object)

resolvePropertyName

public static java.lang.String resolvePropertyName(double number)
Parameters:
number - the number to process
Returns:
the resolved propertyName
See Also:
resolvePropertyName(Object)

resolvePropertyName

public static java.lang.String resolvePropertyName(boolean number)
Parameters:
number - the number to process
Returns:
the resolved propertyName
See Also:
resolvePropertyName(Object)

resolveNestedPropertyName

public static java.lang.String resolveNestedPropertyName(java.lang.Object object)
Resolves the property from the method that was invoked. Usage: Reflexive.resolveNestedPropertyName(myObject.getMyProperty().myNestedProperty()) This would return myProperty.myNestedProperty Only get- and is-methods are supported.

Parameters:
object - The returned object after invoking the created reflexive object
Returns:
the resolved propertyName

resolveNestedPropertyName

public static java.lang.String resolveNestedPropertyName(long value)
Parameters:
value - the returned value after the invocation
Returns:
the nested propertyPath
See Also:
resolveNestedPropertyName(Object)

resolveNestedPropertyName

public static java.lang.String resolveNestedPropertyName(double value)
Parameters:
value - the returned value after the invocation
Returns:
the nested propertyPath
See Also:
resolveNestedPropertyName(Object)

resolveNestedPropertyName

public static java.lang.String resolveNestedPropertyName(boolean value)
Parameters:
value - the returned value after the invocation
Returns:
the nested propertyPath
See Also:
resolveNestedPropertyName(Object)

intercept

public java.lang.Object intercept(java.lang.Object object,
                                  java.lang.reflect.Method method,
                                  java.lang.Object[] args,
                                  net.sf.cglib.proxy.MethodProxy methodProxy)
                           throws java.lang.Throwable
Specified by:
intercept in interface net.sf.cglib.proxy.MethodInterceptor
Throws:
java.lang.Throwable
See Also:
#intercept(java.lang.Object, java.lang.reflect.Method, java.lang.Object[], net.sf.cglib.proxy.MethodProxy)


Copyright © 2007. All Rights Reserved.