edu.vt.middleware.ldap.props
public abstract class AbstractPropertyInvoker extends java.lang.Object
AbstractPropertyInvoker
provides methods common to property
invokers.Modifier and Type | Field and Description |
---|---|
protected java.lang.Class<?> |
clazz
Class to invoke methods on.
|
protected org.apache.commons.logging.Log |
logger
Log for this class.
|
protected java.util.Map<java.lang.String,java.lang.reflect.Method[]> |
properties
Map of all properties to their getter and setter methods.
|
protected static java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.reflect.Method[]>> |
PROPERTIES_CACHE
Cache of properties.
|
Constructor and Description |
---|
AbstractPropertyInvoker() |
Modifier and Type | Method and Description |
---|---|
protected abstract java.lang.Object |
convertValue(java.lang.Class<?> type,
java.lang.String value)
This converts the supplied string value into an Object of the appropriate
supplied type.
|
static java.lang.Class<?> |
createClass(java.lang.String className)
Creates the class with the supplied name.
|
java.util.Set<java.lang.String> |
getProperties()
This returns the property keys.
|
boolean |
hasProperty(java.lang.String name)
This returns whether the supplied property exists.
|
protected void |
initialize(java.lang.Class<?> c,
java.lang.String domain)
Initializes the properties map with the supplied class.
|
static <T> T |
instantiateType(T type,
java.lang.String className)
Creates an instance of the supplied type.
|
static java.lang.Object |
invokeMethod(java.lang.reflect.Method method,
java.lang.Object object,
java.lang.Object arg)
Invokes the supplied method on the supplied object with the supplied
argument.
|
void |
setProperty(java.lang.Object object,
java.lang.String name,
java.lang.String value)
This invokes the setter method for the supplied property name with the
supplied value.
|
protected static final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.reflect.Method[]>> PROPERTIES_CACHE
protected final org.apache.commons.logging.Log logger
protected java.lang.Class<?> clazz
protected java.util.Map<java.lang.String,java.lang.reflect.Method[]> properties
protected void initialize(java.lang.Class<?> c, java.lang.String domain)
c
- to read methods fromdomain
- optional domain that properties are inpublic void setProperty(java.lang.Object object, java.lang.String name, java.lang.String value)
object
- Object
to invoke method onname
- String
property namevalue
- String
property valuejava.lang.IllegalArgumentException
- if an invocation exception occursprotected abstract java.lang.Object convertValue(java.lang.Class<?> type, java.lang.String value)
type
- of object to convert value intovalue
- to parsepublic boolean hasProperty(java.lang.String name)
name
- String
to checkboolean
whether the supplied property existspublic java.util.Set<java.lang.String> getProperties()
Set
of property namespublic static <T> T instantiateType(T type, java.lang.String className)
T
- type of class returnedtype
- of class to createclassName
- to createjava.lang.IllegalArgumentException
- if the supplied class name cannot create
a new instance of Tpublic static java.lang.Class<?> createClass(java.lang.String className)
className
- to createjava.lang.IllegalArgumentException
- if the supplied class name cannot be
createdpublic static java.lang.Object invokeMethod(java.lang.reflect.Method method, java.lang.Object object, java.lang.Object arg)
method
- Method
to invokeobject
- Object
to invoke method onarg
- Object
to invoke method withObject
produced by the invocationjava.lang.IllegalArgumentException
- if an error occurs invoking the methodCopyright © 2014. All Rights Reserved.