Package org.sqlproc.engine
Interface SqlRuntimeContext
- All Known Implementing Classes:
SqlProcessContext
public interface SqlRuntimeContext
The public runtime context.
For more info please see the Tutorials.
- Author:
- Vladimir Hudec
-
Method Summary
Modifier and TypeMethodDescriptionboolean
checkAttribute
(Object bean, String attrName) Checks the attribute getter method existence.boolean
checkMethod
(Class<?> clazz, String methodName, Class<?>... argTypes) Checks the class method existence.boolean
checkMethod
(Object bean, String methodName, Object... args) Checks the bean method existence.getAttribute
(Object bean, String attrName) Returns the value of the specified simple attribute of the specified bean.Class<?>[]
getAttributeParameterizedTypes
(Class<?> clazz, String attrName) Returns the Java parameterized type info for the attribute, if there is one.Class
<?> getAttributeType
(Class<?> clazz, String attrName) Returns the Java type info for the attribute, if there is one.Class
<?> getEnumToClass
(Class<?> clazz) Returns the bean enumeration type.getEnumToValue
(Object bean) Returns the bean enumeration value.getFeature
(String name) Convenient method to obtain a String feature based on the name.getFeature
(SqlFeature feature) Convenient method to obtain a String feature based on the name.getFeature
(SqlFeature feature, String specName) Convenient method to obtain a String feature based on the name.getFeatureAsInt
(SqlFeature feature) Convenient method to obtain an Integer feature based on the name.getFeatureAsObject
(SqlFeature feature) Convenient method to obtain an Object feature based on the name.String[]
getFeatures
(String feature) Convenient method to obtain a String array features based on the name.getGetterType
(Class<?> clazz, String attrName) Returns the attribute getter method types, if there is one.getGetterType
(Object bean, String attrName) Returns the attribute getter method types, if there is one.getInstance
(Class<?> clazz) Returns the new class instanceReturns the factory responsible for the SQL Processor plugins.Returns the factory responsible for the META types construction.getValueToEnum
(Class<?> clazz, Object val) Returns the enumeration instance for the enumeration valueinvokeMethod
(Class<?> clazz, String methodName, Object... args) Invokes the class method with the specified name and parameters.invokeMethod
(Object bean, String methodName, Object... args) Invokes the bean method with the specified name and parameters.boolean
isFeature
(SqlFeature feature) Convenient method to obtain a boolean feature based on the name.void
setAttribute
(Object bean, String attrName, Object attrValue) Sets the value of the specified simple attribute of the specified bean.boolean
simpleSetAttribute
(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 Details
-
getFeature
Convenient method to obtain a String feature based on the name.- Parameters:
name
- name of the feature- Returns:
- value of the feature
-
getFeature
Convenient method to obtain a String feature based on the name.- Parameters:
feature
- the feature- Returns:
- value of the feature
-
getFeature
Convenient method to obtain a String feature based on the name.- Parameters:
feature
- the featurespecName
- the specific name- Returns:
- value of the feature
-
getFeatures
Convenient method to obtain a String array features based on the name.- Parameters:
feature
- the feature- Returns:
- the array of the feature values
-
isFeature
Convenient method to obtain a boolean feature based on the name.- Parameters:
feature
- the feature- Returns:
- value of the feature
-
getFeatureAsInt
Convenient method to obtain an Integer feature based on the name.- Parameters:
feature
- the feature- Returns:
- value of the feature
-
getFeatureAsObject
Convenient method to obtain an Object feature based on the name.- Parameters:
feature
- the feature- Returns:
- value of the feature
-
getTypeFactory
SqlTypeFactory getTypeFactory()Returns the factory responsible for the META types construction.- Returns:
- the factory for the META types construction
-
getPluginFactory
SqlPluginFactory getPluginFactory()Returns the factory responsible for the SQL Processor plugins.- Returns:
- the factory for the SQL Processor plugins
-
getInstance
Returns the new class instance- Parameters:
clazz
- the class to be constructed- Returns:
- the new class instance. Null in the case of any error.
-
getAttributeType
Returns the Java type info for the attribute, if there is one.- Parameters:
clazz
- 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
Returns the Java parameterized type info for the attribute, if there is one.- Parameters:
clazz
- 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
Returns the attribute getter method types, if there is one.- Parameters:
clazz
- 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
Returns the attribute getter method types, if there is one.- Parameters:
bean
- 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
Checks the attribute getter method existence.- Parameters:
bean
- 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
Returns the value of the specified simple attribute of the specified bean.- Parameters:
bean
- 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
Sets the value of the specified simple attribute of the specified bean, if there is one.- Parameters:
bean
- 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
Sets the value of the specified simple attribute of the specified bean.- Parameters:
bean
- 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
Checks the class method existence.- Parameters:
clazz
- 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
Checks the bean method existence.- Parameters:
bean
- 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
Invokes the class method with the specified name and parameters. The method can be a static one.- Parameters:
clazz
- 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
Invokes the bean method with the specified name and parameters.- Parameters:
bean
- 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
Returns the bean enumeration value.- Parameters:
bean
- the bean of the enumeration type- Returns:
- the enumeration value. Null in the case of any error.
-
getEnumToClass
Returns the bean enumeration type.- Parameters:
clazz
- the class of the enumeration type- Returns:
- the enumeration type. Null in the case of any error.
-
getValueToEnum
Returns the enumeration instance for the enumeration value- Parameters:
clazz
- the class of the enumeration typeval
- the enumeration value- Returns:
- the enumeration instance. Null in the case of any error.
-