Package org.sqlproc.engine.impl
Class SqlMetaConst
java.lang.Object
org.sqlproc.engine.impl.SqlMetaConst
- All Implemented Interfaces:
SqlMetaElement
,SqlMetaLogOperand
,SqlMetaSimple
- Direct Known Subclasses:
SqlMetaOperator
A META SQL sub-element. It represents a static input value.
Schematically:
SqlMetaConst +-SqlMetaConstItem.SqlMetaConstItem...^SqlMyType^value
- Author:
- Vladimir Hudec
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SqlInputValue.Code
Which conversion should be done on input value.The list of sub-elements.(package private) final org.slf4j.Logger
The internal slf4j logger.private boolean
An indicator, which is used to control, how the input value is added to the final ANSI SQL.private SqlType
The type of this input value.Values for a special identifier handling, for example a sequence for an identity.Fields inherited from interface org.sqlproc.engine.impl.SqlMetaElement
AND_PREFIX, CONST_PREFIX, IDENT_PREFIX, IDENT_SEPARATOR, lCONST_PREFIX, lIDENT_PREFIX, OR_PREFIX, SET_PREFIX, VALUES_PREFIX, WHERE_PREFIX
-
Constructor Summary
ConstructorsConstructorDescriptionSqlMetaConst
(SqlInputValue.Code caseConversion) Creates a new instance of this entity.SqlMetaConst
(SqlInputValue.Code caseConversion, boolean not) Creates a new instance of this entity.SqlMetaConst
(SqlInputValue.Code caseConversion, boolean not, SqlType type) Creates a new instance of this entity. -
Method Summary
Modifier and TypeMethodDescription(package private) void
Adds a new name.(package private) String
getData
(SqlProcessContext ctx, Object obj) Returns a String representation of input values, after a possible transformation process.(package private) String
Returns a default input value in the case the input attribute is null.Returns the list of sub-elements(package private) Class
<?> getFieldType
(SqlProcessContext ctx, Class<?> attributeType, String attributeName) Returns the static input attribute type.(package private) Object
Returns the static or dynamic input values.(package private) Object
getProperty
(SqlProcessContext ctx, Object obj, String item) Returns the static input attribute value.(package private) SqlType
Returns the type of this input value.(package private) boolean
isNot()
Returns the indicator, which is used to control, how the input value is added to the final ANSI SQL.process
(SqlProcessContext ctx) The main contract for a dynamic ANSI SQL Query generation.boolean
The main contract to evaluate a logical value of META SQL sub-elements.void
setElements
(List<String> elements) Sets the list of sub-elements.(package private) void
setMetaType
(String metaTypeName, SqlMetaType metaType) Sets the internal type of this input value.(package private) void
setNot
(boolean not) Sets the indicator, which is used to control, how the input value is added to the final ANSI SQL.void
Sets the values.
-
Field Details
-
logger
final org.slf4j.Logger loggerThe internal slf4j logger. -
caseConversion
Which conversion should be done on input value. -
not
private boolean notAn indicator, which is used to control, how the input value is added to the final ANSI SQL. A standard behavior is to add an input value only in the case it's not empty. The definition of the emptiness depends on the type of the input value. -
elements
The list of sub-elements. Every sub-element represents the name of an attribute in the input class (the static parameters class). In case there're more names, the input classes are embedded one in other. -
sqlType
The type of this input value. It can be Hibernate or an internal type. -
values
Values for a special identifier handling, for example a sequence for an identity.
-
-
Constructor Details
-
SqlMetaConst
SqlMetaConst(SqlInputValue.Code caseConversion) Creates a new instance of this entity. Used from inside ANTLR parser.- Parameters:
caseConversion
- which conversion should be done on inputValue
-
SqlMetaConst
SqlMetaConst(SqlInputValue.Code caseConversion, boolean not) Creates a new instance of this entity. Used from inside ANTLR parser.- Parameters:
caseConversion
- which conversion should be done on inputValuenot
- an indicator, which is used to control, how the input value is added to the final ANSI SQL
-
SqlMetaConst
SqlMetaConst(SqlInputValue.Code caseConversion, boolean not, SqlType type) Creates a new instance of this entity. Used from inside ANTLR parser.- Parameters:
caseConversion
- which conversion should be done on inputValuenot
- an indicator, which is used to control, how the input value is added to the final ANSI SQLtype
- the type of this input value, which can be Hibernate or an internal type
-
-
Method Details
-
addConst
Adds a new name. This is the name of an attribute in the input class (the static parameters class). In case there're more names, the input classes are embedded one in other.- Parameters:
name
- the next name in the list of names
-
setMetaType
Sets the internal type of this input value.- Parameters:
metaTypeName
- an internal type namemetaType
- an internal type
-
setValues
Sets the values. Right now only for the special of the enumeration type of the input value. The logical evaluation of the input value is based on the comparison to this value.- Parameters:
value
- the value for special treatment, might be an identifier of value2value2
- the value for special treatment
-
getSqlType
SqlType getSqlType()Returns the type of this input value. It can be Hibernate or an internal type.- Returns:
- the type of this input value
-
setNot
void setNot(boolean not) Sets the indicator, which is used to control, how the input value is added to the final ANSI SQL. A standard behavior is to add an input value only in the case it's not empty. The definition of the emptiness depends on the type of the input value.- Parameters:
not
- a new indicator value
-
isNot
boolean isNot()Returns the indicator, which is used to control, how the input value is added to the final ANSI SQL. A standard behavior is to add an input value only in the case it's not empty. The definition of the emptiness depends on the type of the input value.- Returns:
- the indicator value
-
getElements
Returns the list of sub-elements- Returns:
- the list of sub-elements
-
setElements
Sets the list of sub-elements.- Parameters:
elements
- the list of sub-elements
-
process
The main contract for a dynamic ANSI SQL Query generation. Also known as a META SQL processing. The composite pattern main contract. All ANTLR grammar based elements must implement this contract.- Specified by:
process
in interfaceSqlMetaElement
- Parameters:
ctx
- the crate for all input parameters and the context of processing
-
getData
Returns a String representation of input values, after a possible transformation process.- Parameters:
ctx
- the crate for all input parameters and the context of processingobj
- a raw input value- Returns:
- the transformed input value
-
processExpression
The main contract to evaluate a logical value of META SQL sub-elements.- Specified by:
processExpression
in interfaceSqlMetaLogOperand
- Parameters:
ctx
- the context for a dynamic ANSI SQL Query generation- Returns:
- a logical value
-
getInputValues
Returns the static or dynamic input values. The standard input values are the static ones.- Parameters:
ctx
- the crate for all input parameters and the context of processing- Returns:
- the static or dynamic input values
-
getDefaultData
String getDefaultData()Returns a default input value in the case the input attribute is null.- Returns:
- a default input value
-
getFieldType
Returns the static input attribute type.- Parameters:
ctx
- the crate for all input parameters and the context of processingattributeType
- parents typeattributeName
- the attribute name- Returns:
- the static input attribute type
-
getProperty
Returns the static input attribute value.- Parameters:
ctx
- the crate for all input parameters and the context of processingobj
- the static input value POJOitem
- the attribute name- Returns:
- the static input attribute value
-