public abstract class SqlChunk
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
CHUNK_INSERT |
static int |
CHUNK_MATCH |
static int |
CHUNK_RAW |
static int |
CHUNK_REFERENCE |
static int |
CHUNK_SELECT_COLUMNS |
static int |
CHUNK_TABLE |
static int |
CHUNK_UPDATE |
static int |
CHUNK_VALUE |
static int |
COLS_ALL |
static int |
COLS_ALL_BUT_ID |
static int |
COLS_NA |
static int |
COLS_NA_MULTI |
static int |
COLS_ONLY_EXISTING |
static int |
COLS_ONLY_IDS |
protected SqlChunk |
nextChunk |
protected SqlChunk |
previousChunk |
protected TemplateData |
templateData |
Modifier | Constructor and Description |
---|---|
protected |
SqlChunk(DbEntityManager dbEntityManager,
int chunkType) |
Modifier and Type | Method and Description |
---|---|
protected void |
appendMissingSpace(java.lang.StringBuilder out)
Appends missing space if the output doesn't end with whitespace.
|
protected void |
defineParameter(java.lang.StringBuilder query,
java.lang.String name,
java.lang.Object value,
DbEntityColumnDescriptor dec)
Defines parameter with name and its value.
|
protected DbEntityDescriptor |
findColumnRef(java.lang.String columnRef)
Finds a table that contains given column.
|
SqlChunk |
getNextChunk()
Returns next chunk.
|
SqlChunk |
getPreviousChunk()
Returns previous chunk.
|
void |
init(TemplateData templateData)
Initializes chunk.
|
void |
insertChunkAfter(SqlChunk previous)
Appends chunk to previous one and maintains the double-linked list of the previous chunk.
|
protected boolean |
isEmptyColumnValue(DbEntityColumnDescriptor dec,
java.lang.Object value)
Returns
true if a value is considered empty i.e. not existing. |
boolean |
isPreviousChunkOfSameType()
Returns
true if previous chunk is of the same type. |
boolean |
isPreviousChunkOfType(int type)
Returns
true if previous chunk is of provided type. |
boolean |
isPreviousMacroChunk()
Returns
true if previous chunk is not raw. |
boolean |
isPreviousRawChunk() |
protected DbEntityDescriptor |
lookupName(java.lang.String entityName)
Lookups for entity name and throws exception if entity name not found.
|
protected DbEntityDescriptor |
lookupTableRef(java.lang.String tableRef)
Lookups for table reference and throws an exception if table reference not found.
|
protected DbEntityDescriptor |
lookupTableRef(java.lang.String tableRef,
boolean throwExceptionIfNotFound)
Lookups for table reference and optionally throws an exception if table reference not found.
|
protected DbEntityDescriptor |
lookupType(java.lang.Class entity)
Lookups for entity name and throws an exception if entity type is invalid.
|
abstract void |
process(java.lang.StringBuilder out)
Process the chunk and appends data to the output.
|
protected static java.lang.Class |
resolveClass(java.lang.Object object)
Resolves object to a class.
|
protected java.lang.String |
resolveTable(java.lang.String tableRef,
DbEntityDescriptor ded)
Resolves table name or alias that will be used in the query.
|
protected void |
separateByCommaOrSpace(java.lang.StringBuilder out)
Separates from previous chunk by comma if is of the same type.
|
public static final int COLS_NA
public static final int COLS_ONLY_EXISTING
public static final int COLS_ONLY_IDS
public static final int COLS_ALL
public static final int COLS_ALL_BUT_ID
public static final int COLS_NA_MULTI
public static final int CHUNK_RAW
public static final int CHUNK_SELECT_COLUMNS
public static final int CHUNK_TABLE
public static final int CHUNK_REFERENCE
public static final int CHUNK_MATCH
public static final int CHUNK_VALUE
public static final int CHUNK_INSERT
public static final int CHUNK_UPDATE
protected SqlChunk previousChunk
protected SqlChunk nextChunk
protected TemplateData templateData
protected SqlChunk(DbEntityManager dbEntityManager, int chunkType)
public SqlChunk getPreviousChunk()
public SqlChunk getNextChunk()
public void insertChunkAfter(SqlChunk previous)
public boolean isPreviousChunkOfType(int type)
true
if previous chunk is of provided type.public boolean isPreviousChunkOfSameType()
true
if previous chunk is of the same type.public boolean isPreviousMacroChunk()
true
if previous chunk is not raw.public boolean isPreviousRawChunk()
public void init(TemplateData templateData)
TemplateData
to chunk.
If chunk needs some pre-processing, they should be done here.public abstract void process(java.lang.StringBuilder out)
protected DbEntityDescriptor lookupName(java.lang.String entityName)
protected DbEntityDescriptor lookupType(java.lang.Class entity)
protected DbEntityDescriptor lookupTableRef(java.lang.String tableRef)
protected DbEntityDescriptor lookupTableRef(java.lang.String tableRef, boolean throwExceptionIfNotFound)
protected DbEntityDescriptor findColumnRef(java.lang.String columnRef)
protected java.lang.String resolveTable(java.lang.String tableRef, DbEntityDescriptor ded)
protected void defineParameter(java.lang.StringBuilder query, java.lang.String name, java.lang.Object value, DbEntityColumnDescriptor dec)
protected static java.lang.Class resolveClass(java.lang.Object object)
protected boolean isEmptyColumnValue(DbEntityColumnDescriptor dec, java.lang.Object value)
true
if a value is considered empty i.e. not existing.protected void appendMissingSpace(java.lang.StringBuilder out)
protected void separateByCommaOrSpace(java.lang.StringBuilder out)
Copyright © 2003-present Jodd Team