Package org.sqlproc.engine.plugin
Interface BeanUtilsPlugin
-
- All Known Implementing Classes:
DefaultBeanUtilsPlugin
public interface BeanUtilsPlugin
Bean utilities API for the SQL Processor.- Author:
- Vladimir Hudec
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
BeanUtilsPlugin.GetterType
Holder for the getter types (standard and generic ones).
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.Object
getAttribute(SqlRuntimeContext runtimeCtx, Object bean, String attrName)
Returns the value of the specified simple attribute of the specified bean.Class<?>[]
getAttributeParameterizedTypes(SqlRuntimeContext runtimeCtx, Class<?> clazz, String attrName)
Returns the Java parameterized type info for the attribute, if there is one.Class<?>
getAttributeType(SqlRuntimeContext runtimeCtx, Class<?> clazz, String attrName)
Returns the Java type info for the attribute, if there is one.Class<?>
getEnumToClass(SqlRuntimeContext runtimeCtx, Class<?> clazz)
Returns the bean enumeration type.Object
getEnumToValue(SqlRuntimeContext runtimeCtx, Object bean)
Returns the bean enumeration value.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 instanceObject
getValueToEnum(SqlRuntimeContext runtimeCtx, Class<?> clazz, Object val)
Returns the enumeration instance for the enumeration valueObject
invokeMethod(SqlRuntimeContext runtimeCtx, Class<?> clazz, String methodName, Object... args)
Invokes the class method with the specified name and parameters.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.
-
-
-
Method Detail
-
getInstance
Object getInstance(SqlRuntimeContext runtimeCtx, Class<?> clazz)
Returns the new class instance- Parameters:
runtimeCtx
- the public runtime contextclazz
- the class to be constructed- Returns:
- the new class instance. Null in the case of any error.
-
getAttributeType
Class<?> getAttributeType(SqlRuntimeContext runtimeCtx, Class<?> clazz, String attrName)
Returns the Java type info for the attribute, if there is one.- Parameters:
runtimeCtx
- the public runtime contextclazz
- the class for which the attribute type is requestedattrName
- the name of the attribute which type is requested- Returns:
- the object that represents the Java type info. Null in the case there's no such attribute.
-
getAttributeParameterizedTypes
Class<?>[] getAttributeParameterizedTypes(SqlRuntimeContext runtimeCtx, Class<?> clazz, String attrName)
Returns the Java parameterized type info for the attribute, if there is one.- Parameters:
runtimeCtx
- the public runtime contextclazz
- the class for which the attribute type is requestedattrName
- the name of the attribute which type is requested- Returns:
- the object that represents the Java parameterized type info. Null in the case there's no such attribute.
-
getGetterType
BeanUtilsPlugin.GetterType getGetterType(SqlRuntimeContext runtimeCtx, Class<?> clazz, String attrName)
Returns the attribute getter method types, if there is one.- Parameters:
runtimeCtx
- the public runtime contextclazz
- the class for which the getter is requestedattrName
- the name of the attribute which getter is requested- Returns:
- The method that should be used to read the property value. Null in the case there's no such attribute's getter.
-
getGetterType
BeanUtilsPlugin.GetterType getGetterType(SqlRuntimeContext runtimeCtx, Object bean, String attrName)
Returns the attribute getter method types, if there is one.- Parameters:
runtimeCtx
- the public runtime contextbean
- the bean for which the getter is requestedattrName
- the name of the attribute which getter is requested- Returns:
- The getter method types that should be used to read the property value. Null in the case there's no such attribute's getter.
-
checkAttribute
boolean checkAttribute(SqlRuntimeContext runtimeCtx, Object bean, String attrName)
Checks the attribute getter method existence.- Parameters:
runtimeCtx
- the public runtime contextbean
- the bean for which the getter is checkedattrName
- the name of the attribute which getter is checked- Returns:
- True if there's the attribute getter method
-
getAttribute
Object getAttribute(SqlRuntimeContext runtimeCtx, Object bean, String attrName) throws SqlRuntimeException
Returns the value of the specified simple attribute of the specified bean.- Parameters:
runtimeCtx
- the public runtime contextbean
- the bean for which the attribute value is requestedattrName
- the name of the attribute which value is requested- Returns:
- the attribute value
- Throws:
SqlRuntimeException
- in the case of any error
-
simpleSetAttribute
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.- Parameters:
runtimeCtx
- 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 types- Returns:
- True if the attribute was successfully modified
-
setAttribute
void setAttribute(SqlRuntimeContext runtimeCtx, Object bean, String attrName, Object attrValue) throws SqlRuntimeException
Sets the value of the specified simple attribute of the specified bean.- Parameters:
runtimeCtx
- 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 set- Throws:
SqlRuntimeException
- in the case of any error
-
checkMethod
boolean checkMethod(SqlRuntimeContext runtimeCtx, Class<?> clazz, String methodName, Class<?>... argTypes)
Checks the class method existence.- Parameters:
runtimeCtx
- the public runtime contextclazz
- the class for which the method existence is checkedmethodName
- the name of the method to be checkedargTypes
- the method parameters types- Returns:
- True if there's such a method
-
checkMethod
boolean checkMethod(SqlRuntimeContext runtimeCtx, Object bean, String methodName, Object... args)
Checks the bean method existence.- Parameters:
runtimeCtx
- the public runtime contextbean
- the bean for which the method existence is checkedmethodName
- the name of the method to be checkedargs
- the method parameters- Returns:
- True if there's such a method
-
invokeMethod
Object invokeMethod(SqlRuntimeContext runtimeCtx, Class<?> clazz, String methodName, Object... args) throws SqlRuntimeException
Invokes the class method with the specified name and parameters. The method can be a static one.- Parameters:
runtimeCtx
- the public runtime contextclazz
- the class which method is going to be invokedmethodName
- the requested method nameargs
- the method parameters- Returns:
- the result of the method invocation
- Throws:
SqlRuntimeException
- in the case of any error
-
invokeMethod
Object invokeMethod(SqlRuntimeContext runtimeCtx, Object bean, String methodName, Object... args) throws SqlRuntimeException
Invokes the bean method with the specified name and parameters.- Parameters:
runtimeCtx
- the public runtime contextbean
- the bean which method is going to be invokedmethodName
- the requested method nameargs
- the method parameters- Returns:
- the result of the method invocation
- Throws:
SqlRuntimeException
- in the case of any error
-
getEnumToValue
Object getEnumToValue(SqlRuntimeContext runtimeCtx, Object bean)
Returns the bean enumeration value.- Parameters:
runtimeCtx
- the public runtime contextbean
- the bean of the enumeration type- Returns:
- the enumeration value. Null in the case of any error.
-
getEnumToClass
Class<?> getEnumToClass(SqlRuntimeContext runtimeCtx, Class<?> clazz)
Returns the bean enumeration type.- Parameters:
runtimeCtx
- the public runtime contextclazz
- the class of the enumeration type- Returns:
- the enumeration type. Null in the case of any error.
-
getValueToEnum
Object getValueToEnum(SqlRuntimeContext runtimeCtx, Class<?> clazz, Object val)
Returns the enumeration instance for the enumeration value- Parameters:
runtimeCtx
- the public runtime contextclazz
- the class of the enumeration typeval
- the enumeration value- Returns:
- the enumeration instance. Null in the case of any error.
-
-