Class IdBinderEmpty
- java.lang.Object
-
- io.ebeaninternal.server.deploy.id.IdBinderEmpty
-
- All Implemented Interfaces:
IdBinder
public final class IdBinderEmpty extends Object implements IdBinder
For beans with no id properties AKA report type beans.
-
-
Constructor Summary
Constructors Constructor Description IdBinderEmpty()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addIdInBindValues(SpiExpressionRequest request, Collection<?> ids)
Binds multiple id value to a request.void
addIdInBindValues(DefaultSqlUpdate sqlUpdate, Collection<?> ids)
Binds multiple id value to an update.void
appendSelect(DbSqlContext ctx, boolean subQuery)
Append to the select clause.void
bindId(DefaultSqlUpdate sqlUpdate, Object value)
Bind the id value to a SqlUpdate statement.void
bindId(DataBind dataBind, Object value)
Binds an id value to a prepared statement.void
buildRawSqlSelectChain(String prefix, List<String> selectChain)
String
cacheKey(Object bean)
Return a key to use for bean caches given the id value.String
cacheKeyFromBean(EntityBean bean)
Return a key to use for bean caches given the bean.Object
convertId(Object idValue)
Cast or convert the Id value if necessary.Object
convertIdFromJson(Object value)
For EmbeddedId the value is assumed to be a Map and this is takes the values from the map and builds an embedded id bean.Object
convertSetId(Object idValue, EntityBean bean)
Cast or convert the Id value if necessary and optionally set it.BeanProperty
findBeanProperty(String dbColumnName)
Find a BeanProperty that is mapped to the database column.String
getAssocIdInExpr(String prefix)
Return the logical id in expression taking into account embedded id's.String
getAssocOneIdExpr(String prefix, String operator)
Build a string of the logical expressions.BeanProperty
getBeanProperty()
Return the Id BeanProperty.String
getBindIdInSql(String baseTableAlias)
Return the sql for binding the id using an IN clause.String
getBindIdSql(String baseTableAlias)
Return the sql for binding the id to.Object[]
getBindValues(Object idValue)
Return the values as an array of scalar bindable values.String
getDefaultOrderBy()
Return the default order by that may need to be used if the query includes a many property.Object
getIdForJson(EntityBean bean)
For EmbeddedId convert the idValue into a simple map.String
getIdInValueExpr(boolean not, int size)
Return the binding expression (like "?" or "(?,?)")for the Id.String
getIdInValueExprDelete(int size)
Same as getIdInValueExpr but for delete by id.String
getIdProperty()
Return the name(s) of the Id property(s).Object[]
getIdValues(EntityBean bean)
Return the id values for a given bean.String
getOrderBy(String pathPrefix, boolean ascending)
void
initialise()
Initialise the binder.boolean
isComplexId()
Return false if the id is a simple scalar and false if it is embedded or concatenated.boolean
isIdInExpandedForm()
Return true if this is a compound key and must use expanded and or form.void
loadIgnore(DbReadContext ctx)
Ignore the appropriate number of scalar properties for this id.Object
read(DbReadContext ctx)
Read the id value from the result set and return it.Object
readData(DataInput dataOutput)
Read the Id value from the binary DataInput.Object
readSet(DbReadContext ctx, EntityBean bean)
Read the id value from the result set and set it to the bean also returning it.void
writeData(DataOutput dataOutput, Object idValue)
Write the Id value to binary DataOuput.
-
-
-
Constructor Detail
-
IdBinderEmpty
public IdBinderEmpty()
-
-
Method Detail
-
initialise
public void initialise()
Description copied from interface:IdBinder
Initialise the binder.- Specified by:
initialise
in interfaceIdBinder
-
isIdInExpandedForm
public boolean isIdInExpandedForm()
Description copied from interface:IdBinder
Return true if this is a compound key and must use expanded and or form.- Specified by:
isIdInExpandedForm
in interfaceIdBinder
-
getOrderBy
public String getOrderBy(String pathPrefix, boolean ascending)
- Specified by:
getOrderBy
in interfaceIdBinder
-
buildRawSqlSelectChain
public void buildRawSqlSelectChain(String prefix, List<String> selectChain)
- Specified by:
buildRawSqlSelectChain
in interfaceIdBinder
-
getBeanProperty
public BeanProperty getBeanProperty()
Description copied from interface:IdBinder
Return the Id BeanProperty.- Specified by:
getBeanProperty
in interfaceIdBinder
-
getIdProperty
public String getIdProperty()
Description copied from interface:IdBinder
Return the name(s) of the Id property(s). Comma delimited if there is more than one.This can be used to include in a query.
- Specified by:
getIdProperty
in interfaceIdBinder
-
findBeanProperty
public BeanProperty findBeanProperty(String dbColumnName)
Description copied from interface:IdBinder
Find a BeanProperty that is mapped to the database column.- Specified by:
findBeanProperty
in interfaceIdBinder
-
isComplexId
public boolean isComplexId()
Description copied from interface:IdBinder
Return false if the id is a simple scalar and false if it is embedded or concatenated.- Specified by:
isComplexId
in interfaceIdBinder
-
getDefaultOrderBy
public String getDefaultOrderBy()
Description copied from interface:IdBinder
Return the default order by that may need to be used if the query includes a many property.- Specified by:
getDefaultOrderBy
in interfaceIdBinder
-
getBindIdSql
public String getBindIdSql(String baseTableAlias)
Description copied from interface:IdBinder
Return the sql for binding the id to. This includes table alias and columns that make up the id.- Specified by:
getBindIdSql
in interfaceIdBinder
-
getAssocOneIdExpr
public String getAssocOneIdExpr(String prefix, String operator)
Description copied from interface:IdBinder
Build a string of the logical expressions.Typically used to build a id = ? string.
- Specified by:
getAssocOneIdExpr
in interfaceIdBinder
-
getAssocIdInExpr
public String getAssocIdInExpr(String prefix)
Description copied from interface:IdBinder
Return the logical id in expression taking into account embedded id's.- Specified by:
getAssocIdInExpr
in interfaceIdBinder
-
getIdInValueExprDelete
public String getIdInValueExprDelete(int size)
Description copied from interface:IdBinder
Same as getIdInValueExpr but for delete by id.- Specified by:
getIdInValueExprDelete
in interfaceIdBinder
-
getIdInValueExpr
public String getIdInValueExpr(boolean not, int size)
Description copied from interface:IdBinder
Return the binding expression (like "?" or "(?,?)")for the Id.- Specified by:
getIdInValueExpr
in interfaceIdBinder
-
getBindIdInSql
public String getBindIdInSql(String baseTableAlias)
Description copied from interface:IdBinder
Return the sql for binding the id using an IN clause.- Specified by:
getBindIdInSql
in interfaceIdBinder
-
getIdValues
public Object[] getIdValues(EntityBean bean)
Description copied from interface:IdBinder
Return the id values for a given bean.- Specified by:
getIdValues
in interfaceIdBinder
-
getBindValues
public Object[] getBindValues(Object idValue)
Description copied from interface:IdBinder
Return the values as an array of scalar bindable values.For concatenated keys that use an Embedded bean or multiple id properties this determines the field values are returns them as an Object array.
Added primarily for Query.addWhere().add(Expr.idEq()) support.
- Specified by:
getBindValues
in interfaceIdBinder
-
getIdForJson
public Object getIdForJson(EntityBean bean)
Description copied from interface:IdBinder
For EmbeddedId convert the idValue into a simple map. Otherwise the idValue is just returned as is.This is used to provide a simple JSON serializable version of the id value.
- Specified by:
getIdForJson
in interfaceIdBinder
-
convertIdFromJson
public Object convertIdFromJson(Object value)
Description copied from interface:IdBinder
For EmbeddedId the value is assumed to be a Map and this is takes the values from the map and builds an embedded id bean.For other simple id's this just returns the value (no conversion required).
This is used to provide a simple JSON serializable version of the id value.
- Specified by:
convertIdFromJson
in interfaceIdBinder
-
bindId
public void bindId(DefaultSqlUpdate sqlUpdate, Object value)
Description copied from interface:IdBinder
Bind the id value to a SqlUpdate statement.
-
bindId
public void bindId(DataBind dataBind, Object value)
Description copied from interface:IdBinder
Binds an id value to a prepared statement.
-
addIdInBindValues
public void addIdInBindValues(DefaultSqlUpdate sqlUpdate, Collection<?> ids)
Description copied from interface:IdBinder
Binds multiple id value to an update.- Specified by:
addIdInBindValues
in interfaceIdBinder
-
addIdInBindValues
public void addIdInBindValues(SpiExpressionRequest request, Collection<?> ids)
Description copied from interface:IdBinder
Binds multiple id value to a request.- Specified by:
addIdInBindValues
in interfaceIdBinder
-
loadIgnore
public void loadIgnore(DbReadContext ctx)
Description copied from interface:IdBinder
Ignore the appropriate number of scalar properties for this id.- Specified by:
loadIgnore
in interfaceIdBinder
-
readSet
public Object readSet(DbReadContext ctx, EntityBean bean)
Description copied from interface:IdBinder
Read the id value from the result set and set it to the bean also returning it.
-
read
public Object read(DbReadContext ctx)
Description copied from interface:IdBinder
Read the id value from the result set and return it.
-
appendSelect
public void appendSelect(DbSqlContext ctx, boolean subQuery)
Description copied from interface:IdBinder
Append to the select clause.- Specified by:
appendSelect
in interfaceIdBinder
-
convertSetId
public Object convertSetId(Object idValue, EntityBean bean)
Description copied from interface:IdBinder
Cast or convert the Id value if necessary and optionally set it.The Id value is not assumed to be the correct type so it is converted to the correct type. Typically this is because we could get a Integer, Long or BigDecimal depending on the JDBC driver and situation.
If the bean is not null, then the value is set to the bean.
- Specified by:
convertSetId
in interfaceIdBinder
-
convertId
public Object convertId(Object idValue)
Description copied from interface:IdBinder
Cast or convert the Id value if necessary.
-
readData
public Object readData(DataInput dataOutput)
Description copied from interface:IdBinder
Read the Id value from the binary DataInput.
-
writeData
public void writeData(DataOutput dataOutput, Object idValue)
Description copied from interface:IdBinder
Write the Id value to binary DataOuput.
-
cacheKey
public String cacheKey(Object bean)
Description copied from interface:IdBinder
Return a key to use for bean caches given the id value.
-
cacheKeyFromBean
public String cacheKeyFromBean(EntityBean bean)
Description copied from interface:IdBinder
Return a key to use for bean caches given the bean.- Specified by:
cacheKeyFromBean
in interfaceIdBinder
-
-