public class SqlProcessContext extends Object implements SqlRuntimeContext
SqlMetaStatement.process(org.sqlproc.engine.impl.SqlMetaStatement.Type, Object, SqlControl, SqlEngine)
Also can work as a context for a dynamic ANSI SQL query generation. This processing is based on the contract
SqlMetaElement.process(SqlProcessContext)
.Modifier and Type | Field and Description |
---|---|
(package private) Object |
dynamicInputValues
The SQL statement dynamic parameters.
|
(package private) boolean |
inSqlSetOrInsert
An indicator, that the processing is inside of the special SQL fragment - SET or VALUES.
|
(package private) Set<String> |
oppositeNames
Unset features in the runtime.
|
(package private) SqlControl |
sqlControl
The compound parameters controlling the META SQL execution.
|
(package private) SqlEngine |
sqlEngine
The primary SQL Processor class for the META SQL execution.
|
(package private) SqlMetaStatement.Type |
sqlStatementType
The SQL command type.
|
Constructor and Description |
---|
SqlProcessContext(SqlMetaStatement.Type sqlStatementType,
Object dynamicInputValues,
SqlControl sqlControl,
SqlEngine sqlEngine)
Creates a new instance.
|
SqlProcessContext(SqlProcessContext ctx,
Object dynamicInputValues,
SqlControl sqlControl)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkAttribute(Object bean,
String attrName)
Checks the attribute getter method existence.
|
boolean |
checkMethod(Class<?> clazz,
String methodName,
Class<?>... args)
Checks the class method existence.
|
boolean |
checkMethod(Object bean,
String methodName,
Object... args)
Checks the bean method existence.
|
Object |
getAttribute(Object bean,
String attrName)
Returns the value of the specified simple attribute of the specified bean.
|
Class<?> |
getAttributeType(Class<?> clazz,
String attrName)
Returns the Java type info for the attribute, if there is one.
|
Object |
getDynamicInputValues()
Returns the SQL statement dynamic parameters.
|
Class<?> |
getEnumToClass(Class<?> clazz)
Returns the bean enumeration type.
|
Object |
getEnumToValue(Object bean)
Returns the bean enumeration value.
|
String |
getFeature(SqlFeature feature)
Convenient method to obtain a String feature based on the name.
|
String |
getFeature(SqlFeature feature,
String specName)
Convenient method to obtain a String feature based on the name.
|
String |
getFeature(String name)
Convenient method to obtain a String feature based on the name.
|
Integer |
getFeatureAsInt(SqlFeature feature)
Convenient method to obtain an Integer feature based on the name.
|
Object |
getFeatureAsObject(SqlFeature feature)
Convenient method to obtain an Object feature based on the name.
|
String[] |
getFeatures(String name)
Convenient method to obtain a String array features based on the name.
|
BeanUtilsPlugin.GetterType |
getGetterType(Class<?> clazz,
String attrName)
Returns the attribute getter method types, if there is one.
|
BeanUtilsPlugin.GetterType |
getGetterType(Object bean,
String attrName)
Returns the attribute getter method types, if there is one.
|
Object |
getInstance(Class<?> clazz)
Returns the new class instance
|
(package private) List<SqlOrder> |
getOrder()
Returns the list of ordering directives.
|
(package private) SqlOrder.Order |
getOrder(int orderIndex)
Convenient method to obtain the ordering directive based on the index.
|
(package private) int |
getOrderIndex(int orderId)
Convenient method to obtain the index of the ordering directive.
|
SqlPluginFactory |
getPluginFactory()
Returns the factory responsible for the SQL Processor plugins.
|
protected Object |
getRawFeature(SqlFeature feature)
Convenient method to obtain a feature based on the name.
|
protected Object |
getRawFeature(String name)
Convenient method to obtain a feature based on the name.
|
(package private) SqlMetaStatement.Type |
getSqlStatementType()
Returns the SQL command type.
|
Object |
getStaticInputValues()
Returns the SQL statement static parameters.
|
SqlTypeFactory |
getTypeFactory()
Returns the factory responsible for the META types construction.
|
Object |
getValueToEnum(Class<?> objClass,
Object val)
Returns the enumeration instance for the enumeration value
|
private void |
initFeatures()
Initialize the optional features.
|
Object |
invokeMethod(Class<?> clazz,
String methodName,
Object... args)
Invokes the class method with the specified name and parameters.
|
Object |
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.
|
String |
toString()
For debug purposes.
|
SqlMetaStatement.Type sqlStatementType
Object dynamicInputValues
SqlControl sqlControl
SqlEngine sqlEngine
boolean inSqlSetOrInsert
SqlProcessContext(SqlMetaStatement.Type sqlStatementType, Object dynamicInputValues, SqlControl sqlControl, SqlEngine sqlEngine)
sqlStatementType
- the type of the SQL commanddynamicInputValues
- the dynamic input parameterssqlControl
- the compound parameters controlling the META SQL executionsqlEngine
- the primary SQL Processor class for the META SQL executionSqlProcessContext(SqlProcessContext ctx, Object dynamicInputValues, SqlControl sqlControl)
ctx
- the crate for all input parameters and the context of processingdynamicInputValues
- the dynamic input parameterssqlControl
- the compound parameters controlling the META SQL executionprivate void initFeatures()
SqlMetaStatement.Type getSqlStatementType()
public Object getDynamicInputValues()
public Object getStaticInputValues()
public String getFeature(String name)
getFeature
in interface SqlRuntimeContext
name
- name of the featurepublic String getFeature(SqlFeature feature)
getFeature
in interface SqlRuntimeContext
feature
- the featurepublic String getFeature(SqlFeature feature, String specName)
getFeature
in interface SqlRuntimeContext
feature
- the featurespecName
- the specific namepublic String[] getFeatures(String name)
getFeatures
in interface SqlRuntimeContext
name
- the featurepublic boolean isFeature(SqlFeature feature)
isFeature
in interface SqlRuntimeContext
feature
- the featurepublic Integer getFeatureAsInt(SqlFeature feature)
getFeatureAsInt
in interface SqlRuntimeContext
feature
- the featurepublic Object getFeatureAsObject(SqlFeature feature)
getFeatureAsObject
in interface SqlRuntimeContext
feature
- the featureprotected Object getRawFeature(SqlFeature feature)
feature
- the featureprotected Object getRawFeature(String name)
name
- name of the featureList<SqlOrder> getOrder()
int getOrderIndex(int orderId)
orderId
- the order numberSqlOrder.Order getOrder(int orderIndex)
orderIndex
- the index of the ordering rulepublic SqlTypeFactory getTypeFactory()
getTypeFactory
in interface SqlRuntimeContext
public SqlPluginFactory getPluginFactory()
getPluginFactory
in interface SqlRuntimeContext
public Object getInstance(Class<?> clazz)
getInstance
in interface SqlRuntimeContext
clazz
- the class to be constructedpublic Class<?> getAttributeType(Class<?> clazz, String attrName)
getAttributeType
in interface SqlRuntimeContext
clazz
- the class for which the attribute type is requestedattrName
- the name of the attribute which type is requestedpublic BeanUtilsPlugin.GetterType getGetterType(Class<?> clazz, String attrName)
getGetterType
in interface SqlRuntimeContext
clazz
- the class for which the getter is requestedattrName
- the name of the attribute which getter is requestedpublic BeanUtilsPlugin.GetterType getGetterType(Object bean, String attrName)
getGetterType
in interface SqlRuntimeContext
bean
- the bean for which the getter is requestedattrName
- the name of the attribute which getter is requestedpublic boolean checkAttribute(Object bean, String attrName)
checkAttribute
in interface SqlRuntimeContext
bean
- the bean for which the getter is checkedattrName
- the name of the attribute which getter is checkedpublic Object getAttribute(Object bean, String attrName)
getAttribute
in interface SqlRuntimeContext
bean
- the bean for which the attribute value is requestedattrName
- the name of the attribute which value is requestedpublic boolean simpleSetAttribute(Object bean, String attrName, Object attrValue, Class<?>... attrTypes)
simpleSetAttribute
in interface SqlRuntimeContext
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 typespublic void setAttribute(Object bean, String attrName, Object attrValue)
setAttribute
in interface SqlRuntimeContext
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 setpublic boolean checkMethod(Class<?> clazz, String methodName, Class<?>... args)
checkMethod
in interface SqlRuntimeContext
clazz
- the class for which the method existence is checkedmethodName
- the name of the method to be checkedargs
- the method parameters typespublic boolean checkMethod(Object bean, String methodName, Object... args)
checkMethod
in interface SqlRuntimeContext
bean
- the bean for which the method existence is checkedmethodName
- the name of the method to be checkedargs
- the method parameterspublic Object invokeMethod(Class<?> clazz, String methodName, Object... args)
invokeMethod
in interface SqlRuntimeContext
clazz
- the class which method is going to be invokedmethodName
- the requested method nameargs
- the method parameterspublic Object invokeMethod(Object bean, String methodName, Object... args)
invokeMethod
in interface SqlRuntimeContext
bean
- the bean which method is going to be invokedmethodName
- the requested method nameargs
- the method parameterspublic Object getEnumToValue(Object bean)
getEnumToValue
in interface SqlRuntimeContext
bean
- the bean of the enumeration typepublic Class<?> getEnumToClass(Class<?> clazz)
getEnumToClass
in interface SqlRuntimeContext
clazz
- the class of the enumeration typepublic Object getValueToEnum(Class<?> objClass, Object val)
getValueToEnum
in interface SqlRuntimeContext
objClass
- the class of the enumeration typeval
- the enumeration valueCopyright © 2015. All rights reserved.