public class DefaultBeanUtilsPlugin extends Object implements BeanUtilsPlugin
BeanUtilsPlugin.GetterType| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentHashMap<String,Constructor<?>> |
constructors |
protected ConcurrentHashMap<String,PropertyDescriptor[]> |
descriptors |
protected ConcurrentHashMap<String,Method> |
enumsIn |
protected ConcurrentHashMap<String,Method> |
enumsOut |
protected ConcurrentHashMap<String,Method> |
getters |
(package private) org.slf4j.Logger |
logger
The internal slf4j logger.
|
protected ConcurrentHashMap<String,Method> |
methods |
protected ConcurrentHashMap<String,Method> |
setters |
protected ConcurrentHashMap<String,BeanUtilsPlugin.GetterType> |
typeGetters |
protected ConcurrentHashMap<String,Class<?>> |
types |
| Constructor and Description |
|---|
DefaultBeanUtilsPlugin() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
areTheSameParameters(Class<?> methodParameterType,
Class<?> parameterType) |
protected String |
attrTypes2String(Class<?>... attrTypes) |
boolean |
checkAttribute(SqlRuntimeContext runtimeCtx,
Object bean,
String attrName)
Checks the attribute getter method existence.
|
boolean |
checkMethod(SqlRuntimeContext runtimeCtx,
Class<?> clazz,
String methodName,
Class<?>... argTypes)
Checks the class method existence.
|
boolean |
checkMethod(SqlRuntimeContext runtimeCtx,
Object bean,
String methodName,
Object... args)
Checks the bean method existence.
|
protected String |
debugInfo(String msg,
Object bean,
Method method,
Object... args) |
Object |
getAttribute(SqlRuntimeContext runtimeCtx,
Object bean,
String attrName)
Returns the value of the specified simple attribute of the specified bean.
|
protected PropertyDescriptor |
getAttributeDescriptor(Class<?> clazz,
String attrName) |
Class<?> |
getAttributeType(SqlRuntimeContext runtimeCtx,
Class<?> clazz,
String attrName)
Returns the Java type info for the attribute, if there is one.
|
protected PropertyDescriptor[] |
getDescriptors(Class<?> clazz) |
Class<?> |
getEnumToClass(SqlRuntimeContext runtimeCtx,
Class<?> clazz)
Returns the bean enumeration type.
|
Object |
getEnumToValue(SqlRuntimeContext runtimeCtx,
Object bean)
Returns the bean enumeration value.
|
protected Method |
getGetter(SqlRuntimeContext runtimeCtx,
Class<?> clazz,
String attrName,
boolean onlyCheck) |
BeanUtilsPlugin.GetterType |
getGetterType(SqlRuntimeContext runtimeCtx,
Class<?> clazz,
String attrName)
Returns the attribute getter method types, if there is one.
|
BeanUtilsPlugin.GetterType |
getGetterType(SqlRuntimeContext runtimeCtx,
Object bean,
String attrName)
Returns the attribute getter method types, if there is one.
|
Object |
getInstance(SqlRuntimeContext runtimeCtx,
Class<?> clazz)
Returns the new class instance
|
protected Constructor<?> |
getInstanceConstructor(SqlRuntimeContext runtimeCtx,
Class<?> clazz) |
protected Method |
getInterfaceMethod(Class<?> clazz,
String methodName,
Class<?>[] parameterTypes) |
protected Method |
getMethod(Class<?> clazz,
Method method,
boolean onlyCheck) |
protected Method |
getMethod(Class<?> clazz,
String methodName,
boolean onlyCheck,
Class<?>... parameterTypes) |
protected Class<?> |
getPrimitiveWrapper(Class<?> primitiveType) |
protected Method |
getSetter(SqlRuntimeContext runtimeCtx,
Class<?> clazz,
String attrName,
boolean onlyCheck,
Class<?>... attrTypes) |
protected Method |
getSetter(SqlRuntimeContext runtimeCtx,
Object bean,
String attrName,
boolean onlyCheck,
Class<?>... attrTypes) |
protected Method |
getSuperclassMethod(Class<?> clazz,
String methodName,
Class<?>[] parameterTypes) |
Object |
getValueToEnum(SqlRuntimeContext runtimeCtx,
Class<?> clazz,
Object val)
Returns the enumeration instance for the enumeration value
|
protected Object |
invokeMethod(SqlRuntimeContext runtimeCtx,
Class<?> clazz,
Object bean,
String methodName,
Object... args) |
Object |
invokeMethod(SqlRuntimeContext runtimeCtx,
Class<?> clazz,
String methodName,
Object... args)
Invokes the class method with the specified name and parameters.
|
protected Object |
invokeMethod(SqlRuntimeContext runtimeCtx,
Object bean,
Method method,
Object... args) |
Object |
invokeMethod(SqlRuntimeContext runtimeCtx,
Object bean,
String methodName,
Object... args)
Invokes the bean method with the specified name and parameters.
|
void |
setAttribute(SqlRuntimeContext runtimeCtx,
Object bean,
String attrName,
Object attrValue)
Sets the value of the specified simple attribute of the specified bean.
|
boolean |
simpleSetAttribute(SqlRuntimeContext runtimeCtx,
Object bean,
String attrName,
Object attrValue,
Class<?>... attrTypes)
Sets the value of the specified simple attribute of the specified bean, if there is one.
|
protected Object[] |
toArray(Object arg) |
protected Class<?>[] |
toParameterTypes(Object arg) |
protected Class<?>[] |
toParameterTypes(Object[] args) |
protected ConcurrentHashMap<String,Constructor<?>> constructors
protected ConcurrentHashMap<String,PropertyDescriptor[]> descriptors
protected ConcurrentHashMap<String,Class<?>> types
protected ConcurrentHashMap<String,Method> getters
protected ConcurrentHashMap<String,BeanUtilsPlugin.GetterType> typeGetters
protected ConcurrentHashMap<String,Method> setters
protected ConcurrentHashMap<String,Method> methods
protected ConcurrentHashMap<String,Method> enumsIn
protected ConcurrentHashMap<String,Method> enumsOut
final org.slf4j.Logger logger
protected Constructor<?> getInstanceConstructor(SqlRuntimeContext runtimeCtx, Class<?> clazz)
public Object getInstance(SqlRuntimeContext runtimeCtx, Class<?> clazz)
getInstance in interface BeanUtilsPluginruntimeCtx - the public runtime contextclazz - the class to be constructedprotected PropertyDescriptor[] getDescriptors(Class<?> clazz)
protected PropertyDescriptor getAttributeDescriptor(Class<?> clazz, String attrName)
public Class<?> getAttributeType(SqlRuntimeContext runtimeCtx, Class<?> clazz, String attrName)
BeanUtilsPlugingetAttributeType in interface BeanUtilsPluginruntimeCtx - the public runtime contextclazz - the class for which the attribute type is requestedattrName - the name of the attribute which type is requestedprotected Method getGetter(SqlRuntimeContext runtimeCtx, Class<?> clazz, String attrName, boolean onlyCheck)
public BeanUtilsPlugin.GetterType getGetterType(SqlRuntimeContext runtimeCtx, Class<?> clazz, String attrName)
getGetterType in interface BeanUtilsPluginruntimeCtx - the public runtime contextclazz - the class for which the getter is requestedattrName - the name of the attribute which getter is requestedpublic BeanUtilsPlugin.GetterType getGetterType(SqlRuntimeContext runtimeCtx, Object bean, String attrName)
getGetterType in interface BeanUtilsPluginruntimeCtx - the public runtime contextbean - the bean for which the getter is requestedattrName - the name of the attribute which getter is requestedpublic boolean checkAttribute(SqlRuntimeContext runtimeCtx, Object bean, String attrName)
checkAttribute in interface BeanUtilsPluginruntimeCtx - the public runtime contextbean - the bean for which the getter is checkedattrName - the name of the attribute which getter is checkedpublic Object getAttribute(SqlRuntimeContext runtimeCtx, Object bean, String attrName) throws SqlRuntimeException
getAttribute in interface BeanUtilsPluginruntimeCtx - the public runtime contextbean - the bean for which the attribute value is requestedattrName - the name of the attribute which value is requestedSqlRuntimeException - in the case of any errorprotected Method getSetter(SqlRuntimeContext runtimeCtx, Class<?> clazz, String attrName, boolean onlyCheck, Class<?>... attrTypes)
protected Method getSetter(SqlRuntimeContext runtimeCtx, Object bean, String attrName, boolean onlyCheck, Class<?>... attrTypes)
public boolean simpleSetAttribute(SqlRuntimeContext runtimeCtx, Object bean, String attrName, Object attrValue, Class<?>... attrTypes)
simpleSetAttribute in interface BeanUtilsPluginruntimeCtx - the public runtime contextbean - the bean for which the attribute value is to be modifiedattrName - the name of the attribute to be modifiedattrValue - the value to which the attribute should be setattrTypes - the possible attribute typespublic void setAttribute(SqlRuntimeContext runtimeCtx, Object bean, String attrName, Object attrValue) throws SqlRuntimeException
setAttribute in interface BeanUtilsPluginruntimeCtx - the public runtime contextbean - the bean for which the attribute value is to be modifiedattrName - the name of the attribute to be modifiedattrValue - the value to which the attribute should be setSqlRuntimeException - in the case of any errorprotected Method getInterfaceMethod(Class<?> clazz, String methodName, Class<?>[] parameterTypes)
protected Method getSuperclassMethod(Class<?> clazz, String methodName, Class<?>[] parameterTypes)
protected Method getMethod(Class<?> clazz, String methodName, boolean onlyCheck, Class<?>... parameterTypes)
protected final boolean areTheSameParameters(Class<?> methodParameterType, Class<?> parameterType)
protected Object invokeMethod(SqlRuntimeContext runtimeCtx, Object bean, Method method, Object... args)
public boolean checkMethod(SqlRuntimeContext runtimeCtx, Class<?> clazz, String methodName, Class<?>... argTypes)
checkMethod in interface BeanUtilsPluginruntimeCtx - the public runtime contextclazz - the class for which the method existence is checkedmethodName - the name of the method to be checkedargTypes - the method parameters typespublic boolean checkMethod(SqlRuntimeContext runtimeCtx, Object bean, String methodName, Object... args)
checkMethod in interface BeanUtilsPluginruntimeCtx - the public runtime contextbean - the bean for which the method existence is checkedmethodName - the name of the method to be checkedargs - the method parameterspublic Object invokeMethod(SqlRuntimeContext runtimeCtx, Class<?> clazz, String methodName, Object... args) throws SqlRuntimeException
invokeMethod in interface BeanUtilsPluginruntimeCtx - the public runtime contextclazz - the class which method is going to be invokedmethodName - the requested method nameargs - the method parametersSqlRuntimeException - in the case of any errorpublic Object invokeMethod(SqlRuntimeContext runtimeCtx, Object bean, String methodName, Object... args) throws SqlRuntimeException
invokeMethod in interface BeanUtilsPluginruntimeCtx - the public runtime contextbean - the bean which method is going to be invokedmethodName - the requested method nameargs - the method parametersSqlRuntimeException - in the case of any errorprotected Object invokeMethod(SqlRuntimeContext runtimeCtx, Class<?> clazz, Object bean, String methodName, Object... args) throws SqlRuntimeException
SqlRuntimeExceptionpublic Object getEnumToValue(SqlRuntimeContext runtimeCtx, Object bean)
getEnumToValue in interface BeanUtilsPluginruntimeCtx - the public runtime contextbean - the bean of the enumeration typepublic Class<?> getEnumToClass(SqlRuntimeContext runtimeCtx, Class<?> clazz)
getEnumToClass in interface BeanUtilsPluginruntimeCtx - the public runtime contextclazz - the class of the enumeration typepublic Object getValueToEnum(SqlRuntimeContext runtimeCtx, Class<?> clazz, Object val)
getValueToEnum in interface BeanUtilsPluginruntimeCtx - the public runtime contextclazz - the class of the enumeration typeval - the enumeration valueCopyright © 2016. All rights reserved.