class SqlMappingItem extends Object implements SqlMetaElement
process(SqlProcessContext).| Modifier and Type | Field and Description |
|---|---|
private List<SqlMappingAttribute> |
attributes
The list of all partial attribute names in the result class.
|
private Map<String,SqlMappingAttribute> |
attributesMap
The map of all partial attribute names in the result class.
|
private String |
dbName
The name of a database query output.
|
private StringBuilder |
fullName
The full name of the attribute in the result class in the form name1.name2...nameX.
|
private boolean |
identity
The indicator this is an identity column.
|
(package private) org.slf4j.Logger |
logger
The internal slf4j logger.
|
private SqlType |
sqlType
The (META) type of an attribute in the result class and/or the database column type.
|
(package private) Map<String,String> |
values
Supplements values for a special handling, for example the identification of an identity column or the partial
attribute type.
|
AND_PREFIX, CONST_PREFIX, IDENT_PREFIX, IDENT_SEPARATOR, lCONST_PREFIX, lIDENT_PREFIX, OR_PREFIX, SET_PREFIX, VALUES_PREFIX, WHERE_PREFIX| Constructor and Description |
|---|
SqlMappingItem(String dbName)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) SqlMappingAttribute |
addAttributeName(String name)
Adds a partial name of an attribute.
|
(package private) List<SqlMappingAttribute> |
getAttributes()
Returns the list of all partial attribute names in the result class.
|
(package private) String |
getDbName()
Returns the name of a database query output.
|
(package private) String |
getFullName()
Returns the full attribute name.
|
(package private) String |
getName()
Returns the last attribute name.
|
(package private) SqlType |
getSqlType()
Returns the internal type of an attribute in the result class.
|
(package private) boolean |
isIdentity(SqlProcessContext ctx)
Returns the indicator this is an identity column.
|
(package private) SqlMappingItem |
merge(SqlMappingItem outputMapping)
Merge mapping rules for one output column based on SqlMapping.g and SqlStatement.g.
|
SqlProcessResult |
process(SqlProcessContext ctx)
The main contract for a dynamic ANSI SQL Query generation.
|
(package private) void |
setAttributes(List<SqlMappingAttribute> attributes)
Sets the list of all partial attribute names in the result class.
|
(package private) void |
setAttributesMap(Map<String,SqlMappingAttribute> attributesMap)
Sets the map of all partial attribute names in the result class.
|
(package private) SqlMappingAttribute |
setAttributeValue(String attrName,
String value)
Injects value to the named attribute.
|
(package private) void |
setMetaType(SqlMetaType metaType)
Assigns the internal type.
|
(package private) void |
setQueryResultData(SqlProcessContext ctx,
Object resultInstance,
int resultIndex,
Object[] resultValues,
Map<String,Object> ids,
Map<String,Object> idsProcessed,
Map<String,SqlMappingIdentity> identities,
Map<String,Class<?>> moreResultClasses)
Initializes the attribute of the result class with the output value from the SQL query execution.
|
(package private) void |
setQueryResultMapping(SqlProcessContext ctx,
Class<?> resultClass,
Map<String,Class<?>> moreResultClasses,
SqlQuery query)
Declares a scalar query result for this mapping rule item.
|
(package private) void |
setSqlType(SqlType sqlType)
Sets the internal type of an attribute in the result class.
|
(package private) void |
setValues(String value,
String value2)
Sets the modifiers.
|
(package private) void |
setValues(String name,
String value,
String value2)
Sets the modifiers.
|
String |
toString()
For debug purposes.
|
final org.slf4j.Logger logger
private List<SqlMappingAttribute> attributes
private Map<String,SqlMappingAttribute> attributesMap
private String dbName
private StringBuilder fullName
private SqlType sqlType
private boolean identity
SqlMappingItem(String dbName)
dbName - the name of a database query outputString getDbName()
SqlMappingAttribute addAttributeName(String name)
name - the partial name of an attribute in the result classSqlMappingAttribute setAttributeValue(String attrName, String value)
attrName - the attribute namevalue - value for the named attributeList<SqlMappingAttribute> getAttributes()
void setAttributes(List<SqlMappingAttribute> attributes)
attributes - the list of all partial attribute namesvoid setAttributesMap(Map<String,SqlMappingAttribute> attributesMap)
attributesMap - the map of all partial attribute namesboolean isIdentity(SqlProcessContext ctx)
ctx - the crate for all input parameters and the context of processingString getFullName()
String getName()
void setMetaType(SqlMetaType metaType)
metaType - an internal type for this mapping rule itemSqlType getSqlType()
void setSqlType(SqlType sqlType)
sqlType - the internal type of an attribute in the result classvoid setValues(String value, String value2)
value - the value for a special treatment, might be an identifier of value2value2 - the value for a special treatment, might be an attribute typevoid setValues(String name, String value, String value2)
name - the partial name in the case this modifier is related to itvalue - the value for a special treatment, might be an identifier of value2value2 - the value for a special treatment, might be an attribute typevoid setQueryResultMapping(SqlProcessContext ctx, Class<?> resultClass, Map<String,Class<?>> moreResultClasses, SqlQuery query) throws SqlRuntimeException
ctx - the crate for all input parameters and the context of processingresultClass - the class used for the return values, the SQL execution outputmoreResultClasses - more classes used for the return values, like the classes for the collections or the collections itemsquery - the SQL Engine query, an adapter or proxy to the internal JDBC or ORM staffSqlRuntimeException - in the case of any problem with output values preparationvoid setQueryResultData(SqlProcessContext ctx, Object resultInstance, int resultIndex, Object[] resultValues, Map<String,Object> ids, Map<String,Object> idsProcessed, Map<String,SqlMappingIdentity> identities, Map<String,Class<?>> moreResultClasses) throws SqlRuntimeException
ctx - the crate for all input parameters and the context of processingresultInstance - the instance of the result classresultIndex - the index of the processed query execution output valueresultValues - the query execution output valuesids - the instances of all already used identities together with the related result instances based on
identities indicesidsProcessed - the instances of all already used identities together with the related result instances based on
identities indices - the working copyidentities - the collection of identities related to all output columnsmoreResultClasses - more result classes used for the return values, like the classes for the collections or the
collections itemsSqlRuntimeException - in the case of any problem with output values handlingSqlMappingItem merge(SqlMappingItem outputMapping)
outputMapping - the mapping rule based on SqlStatement.gpublic SqlProcessResult process(SqlProcessContext ctx)
process in interface SqlMetaElementctx - the crate for all input parameters and the context of processingCopyright © 2016. All rights reserved.