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
 boolean 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.
 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.
 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 feature)
          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
 SqlPluginFactory getPluginFactory()
          Returns the factory responsible for the SQL Processor plugins.
 SqlTypeFactory getTypeFactory()
          Returns the factory responsible for the META types construction.
 Object getValueToEnum(Class<?> clazz, Object val)
          Returns the enumeration instance for the enumeration value
 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.
 

Method Detail

getFeature

String getFeature(String name)
Convenient method to obtain a String feature based on the name.

Parameters:
name - name of the feature
Returns:
value of the feature

getFeature

String getFeature(SqlFeature feature)
Convenient method to obtain a String feature based on the name.

Parameters:
feature - the feature
Returns:
value of the feature

getFeature

String getFeature(SqlFeature feature,
                  String specName)
Convenient method to obtain a String feature based on the name.

Parameters:
feature - the feature
specName - the specific name
Returns:
value of the feature

getFeatures

String[] getFeatures(String feature)
Convenient method to obtain a String array features based on the name.

Parameters:
feature - the feature
Returns:
the array of the feature values

isFeature

boolean isFeature(SqlFeature feature)
Convenient method to obtain a boolean feature based on the name.

Parameters:
feature - the feature
Returns:
value of the feature

getFeatureAsInt

Integer getFeatureAsInt(SqlFeature feature)
Convenient method to obtain an Integer feature based on the name.

Parameters:
feature - the feature
Returns:
value of the feature

getFeatureAsObject

Object getFeatureAsObject(SqlFeature feature)
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

Object getInstance(Class<?> clazz)
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

Class<?> getAttributeType(Class<?> clazz,
                          String attrName)
Returns the Java type info for the attribute, if there is one.

Parameters:
clazz - the class for which the attribute type is requested
attrName - 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.

getGetterType

BeanUtilsPlugin.GetterType getGetterType(Class<?> clazz,
                                         String attrName)
Returns the attribute getter method types, if there is one.

Parameters:
clazz - the class for which the getter is requested
attrName - 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(Object bean,
                                         String attrName)
Returns the attribute getter method types, if there is one.

Parameters:
bean - the bean for which the getter is requested
attrName - 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(Object bean,
                       String attrName)
Checks the attribute getter method existence.

Parameters:
bean - the bean for which the getter is checked
attrName - the name of the attribute which getter is checked
Returns:
True if there's the attribute getter method

getAttribute

Object getAttribute(Object bean,
                    String attrName)
                    throws SqlRuntimeException
Returns the value of the specified simple attribute of the specified bean.

Parameters:
bean - the bean for which the attribute value is requested
attrName - the name of the attribute which value is requested
Returns:
the attribute value
Throws:
SqlRuntimeException - in the case of any error

simpleSetAttribute

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.

Parameters:
bean - the bean for which the attribute value is to be modified
attrName - the name of the attribute to be modified
attrValue - the value to which the attribute should be set
attrTypes - the possible attribute types
Returns:
True if the attribute was successfully modified

setAttribute

void setAttribute(Object bean,
                  String attrName,
                  Object attrValue)
                  throws SqlRuntimeException
Sets the value of the specified simple attribute of the specified bean.

Parameters:
bean - the bean for which the attribute value is to be modified
attrName - the name of the attribute to be modified
attrValue - the value to which the attribute should be set
Throws:
SqlRuntimeException - in the case of any error

checkMethod

boolean checkMethod(Class<?> clazz,
                    String methodName,
                    Class<?>... argTypes)
Checks the class method existence.

Parameters:
clazz - the class for which the method existence is checked
methodName - the name of the method to be checked
argTypes - the method parameters types
Returns:
True if there's such a method

checkMethod

boolean checkMethod(Object bean,
                    String methodName,
                    Object... args)
Checks the bean method existence.

Parameters:
bean - the bean for which the method existence is checked
methodName - the name of the method to be checked
args - the method parameters
Returns:
True if there's such a method

invokeMethod

Object invokeMethod(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:
clazz - the class which method is going to be invoked
methodName - the requested method name
args - the method parameters
Returns:
the result of the method invocation
Throws:
SqlRuntimeException - in the case of any error

invokeMethod

Object invokeMethod(Object bean,
                    String methodName,
                    Object... args)
                    throws SqlRuntimeException
Invokes the bean method with the specified name and parameters.

Parameters:
bean - the bean which method is going to be invoked
methodName - the requested method name
args - the method parameters
Returns:
the result of the method invocation
Throws:
SqlRuntimeException - in the case of any error

getEnumToValue

Object getEnumToValue(Object bean)
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

Class<?> getEnumToClass(Class<?> clazz)
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

Object getValueToEnum(Class<?> clazz,
                      Object val)
Returns the enumeration instance for the enumeration value

Parameters:
clazz - the class of the enumeration type
val - the enumeration value
Returns:
the enumeration instance. Null in the case of any error.


Copyright © 2015. All rights reserved.