java.lang.Object
io.ebeaninternal.server.deploy.BeanProperty
- All Implemented Interfaces:
ScalarDataReader<Object>,ExpressionPath,Property,ElPropertyDeploy,ElPropertyValue,STreeProperty
- Direct Known Subclasses:
BeanPropertyAssoc,BeanPropertyJsonBasic,BeanPropertyOrderColumn
Description of a property of a bean. Includes its deployment information such
as database column mapping information.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanFlag to mark this is the id property.Fields inherited from interface io.ebeaninternal.server.el.ElPropertyDeploy
ROOT_ELPREFIX -
Constructor Summary
ConstructorsModifierConstructorDescriptionBeanProperty(BeanDescriptor<?> descriptor, DeployBeanProperty deploy) protectedBeanProperty(BeanProperty source, io.ebeaninternal.server.deploy.BeanPropertyOverride override) Create a Matching BeanProperty with some attributes overridden for Embedded beans.BeanProperty(DeployBeanProperty deploy) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the tenantId predicate to the query.voidappendFrom(DbSqlContext ctx, SqlJoinType joinType, String manyWhere) Add any extra joins required to support this property.voidappendSelect(DbSqlContext ctx, boolean subQuery) Append to the select clause.assocIdExpression(String prefix, String operator) assocIdInExpr(String prefix) Return the logical id in expression taking into account embedded id's.assocIdInValueExpr(boolean not, int size) Return the logical id value expression taking into account embedded id's.Object[]assocIdValues(EntityBean bean) assocIsEmpty(SpiExpressionRequest request, String path) Return the logical where clause to support "Is empty".Return the underlying bean property.voidbuildElPropertyValue(String propName, String remainder, ElPropertyChainBuilder chain, boolean propertyDeploy) voidbuildRawSqlSelectChain(String prefix, List<String> selectChain) For RawSql build the select chain.booleanReturn true if the property is a formula with a join clause.booleanReturn true if there is a property on the path that is a many property.booleancontainsManySince(String sinceProperty) Return true if there is a property is on the path after sinceProperty that is a 'many' property.createMutableInfo(String json) creates a mutableHash for the given JSON value.dbBind()Return the DB bind parameter.Return the DB constraint expression (can be null).dbColumn()The database column name this is mapped to.Return the DB column default to use for DDL.Return a specific column DDL definition if specified (otherwise null).Return the comment for the associated DB column.intintdbLength()Return the DB max length (varchar) or precision (decimal).Return the DDL-Migration InfosintdbScale()Return the DB scale for numeric columns.intdbType(boolean platformTypes) Return the database jdbc data type this is mapped to.decryptProperty(String propertyName) intReturn the order this property appears in the bean.Return the BeanDescriptor that owns this property.voiddiff(String prefix, Map<String, ValuePair> map, EntityBean newBean, EntityBean oldBean) Populate diff map comparing the property values between the beans.elName()The ElPrefix plus name.elPlaceholder(boolean encrypted) Return the place holder in the form of ${elPrefix}dbColumn.elPrefix()Return the prefix path of the property.Return the encrypt key for the column matching this property.Return the encryption key as a string value (when the property is encrypted).intReturn the fetch preference.Return the value in String format (for bean cache key).fullName()Return the full name of this property.io.ebeaninternal.server.deploy.generatedproperty.GeneratedPropertyReturn the GeneratedValue.getCacheDataValue(EntityBean bean) Return the value for this property which we hold in the L2 cache entry.Return the bean cache value for this property using original values.getValue(EntityBean bean) Return the value of the property method.getValueIntercept(EntityBean bean) voidinitialise(io.ebeaninternal.server.deploy.BeanDescriptorInitContext initContext) Initialise the property before returning to client code.booleanReturn true if this is an aggregation property.booleanbooleanisAssignableFrom(Class<?> type) booleanReturn true if this is an ManyToOne or OneToOne associated bean property.booleanReturn true if the property is a OneToMany or ManyToMany associated bean property.booleanReturn true if any path of this path contains a Associated One or Many.booleanReturn true if this property should be included in the cache bean data.booleanReturn true if this property is stored encrypted.booleanReturn true if this property should be included in an Insert.booleanReturn true if this property should be included in an Update.booleanReturn true if this property should have a DB Column created in DDL.booleanReturn true if DDL Not NULL constraint should be defined for this column based on it being a version column or having a generated property.booleanReturn true if this property maps to the inheritance discriminator column.booleanReturn true if this is an Embedded property.booleanReturn true if this property is excluded from history.booleanReturn true if by default this property is set to fetch eager.booleanReturn true if this property is based on a formula.booleanReturn true if this is a generated or Id property.booleanisId()Return true if this is included in the unique id.booleanIf true this bean maps to the primary key.booleanbooleanReturn true if this property is loadable from a resultSet.booleanisLob()Return true if this is mapped to a Clob Blob LongVarchar or LongVarbinary.booleanReturns true if thisisLob()or the type will effectively map to a lob.static booleanisLobType(int type) booleanisLocal()Return true is this type is not from a super type.booleanReturns true if DB encrypted.booleanisMany()booleanReturn true if the underlying type is mutable.booleanReturn true if this is the natural key property.booleanReturn true if this property is mandatory.booleanisScalar()Return true is this is a simple scalar property.booleanReturn true if this property is based on a secondary table (not the base table).booleanReturn true if this property is the soft delete property.booleanReturn true if this is the tenantId property (for multi-tenant partitioning).booleanReturn true if the property is transient.booleanisUnique()Return true if the DB column should be unique.booleanReturn true if this property hold unmapped JSON.booleanReturn true if this is a version column used for concurrency checking.intjdbcType()jsonRead(SpiJsonReader ctx) voidjsonRead(SpiJsonReader ctx, EntityBean bean) voidjsonWrite(SpiJsonWriter writeJson, EntityBean bean) JSON write the bean property.voidjsonWriteForInsert(SpiJsonWriter writeJson, EntityBean bean) JSON write the property for 'insert only depth'.voidjsonWriteValue(SpiJsonWriter writeJson, Object value) JSON write the property value.voidload(SqlBeanLoad sqlBeanLoad) Load into the bean (from the DataReader/ResultSet).voidloadIgnore(DbReadContext ctx) Ignore the property (moving the column index position without reading).localEncrypt(Object value) Encrypt the input value return the encrypted value.voidmerge(EntityBean bean, EntityBean existing) name()Return the name of the property.override(io.ebeaninternal.server.deploy.BeanPropertyOverride override) Return the value from String format into Object value.pathGetNested(Object bean) Return the value ensuring objects prior to the top scalar property are automatically populated.voidproperty()intReturn the position of this property in the enhanced bean.read(DataReader reader) read(DbReadContext ctx) readSet(DataReader reader, EntityBean bean) readSet(DbReadContext ctx, EntityBean bean) voidregisterColumn(BeanDescriptor<?> desc, String prefix) renderDbType(DbPlatformType dbType, boolean strict) Return the DB column type definition.Return the scalarType.Returns null unless this property is using a secondary table.voidsetCacheDataValue(EntityBean bean, Object cacheData, PersistenceContext context) Read the value for this property from L2 cache entry and set it to the bean.voidsetDeployOrder(int deployOrder) Set the order this property appears in the bean.voidsetTenantValue(EntityBean entityBean, Object tenantId) Set the tenantId onto the bean.voidsetValue(EntityBean bean, Object value) Set the value of the property without interception or PropertyChangeSupport.voidsetValueChanged(EntityBean bean, Object value) Set the changed value without invoking interception (lazy loading etc).voidsetValueIntercept(EntityBean bean, Object value) Set the value of the property.toString()Class<?> type()Return the property type.voidwriteData(DataOutput dataOutput, Object value) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.ebeaninternal.server.query.STreeProperty
extraIncludes, isAggregationManyToOne
-
Field Details
-
id
protected final boolean idFlag to mark this is the id property.
-
-
Constructor Details
-
BeanProperty
-
BeanProperty
-
BeanProperty
protected BeanProperty(BeanProperty source, io.ebeaninternal.server.deploy.BeanPropertyOverride override) Create a Matching BeanProperty with some attributes overridden for Embedded beans.
-
-
Method Details
-
override
-
initialise
public void initialise(io.ebeaninternal.server.deploy.BeanDescriptorInitContext initContext) Initialise the property before returning to client code. Used to initialise variables that can't be done in construction due to recursive issues. -
deployOrder
public int deployOrder()Return the order this property appears in the bean. -
setDeployOrder
public void setDeployOrder(int deployOrder) Set the order this property appears in the bean. -
buildElPropertyValue
public ElPropertyValue buildElPropertyValue(String propName, String remainder, ElPropertyChainBuilder chain, boolean propertyDeploy) -
descriptor
Return the BeanDescriptor that owns this property. -
isScalar
public boolean isScalar()Return true is this is a simple scalar property. -
isDDLColumn
public boolean isDDLColumn()Return true if this property should have a DB Column created in DDL. -
isFormula
public boolean isFormula()Return true if this property is based on a formula.- Specified by:
isFormulain interfaceSTreeProperty
-
isDiscriminator
public boolean isDiscriminator()Return true if this property maps to the inheritance discriminator column. -
isMutableScalarType
public boolean isMutableScalarType()Return true if the underlying type is mutable. -
encryptKey
Return the encrypt key for the column matching this property. -
encryptKeyAsString
Description copied from interface:STreePropertyReturn the encryption key as a string value (when the property is encrypted).- Specified by:
encryptKeyAsStringin interfaceSTreeProperty
-
decryptProperty
-
fetchPreference
public int fetchPreference()Description copied from interface:ElPropertyDeployReturn the fetch preference. This can be used to control which ToMany relationship is left as a 'join' and which get converted to query join.- Specified by:
fetchPreferencein interfaceElPropertyDeploy
-
appendFrom
Add any extra joins required to support this property. Generally a no operation except for a OneToOne exported.- Specified by:
appendFromin interfaceSTreeProperty
-
secondaryTableJoinPrefix
Returns null unless this property is using a secondary table. In that case this returns the logical property prefix. -
isAggregation
public boolean isAggregation()Description copied from interface:ElPropertyDeployReturn true if this is an aggregation property.- Specified by:
isAggregationin interfaceElPropertyDeploy- Specified by:
isAggregationin interfaceSTreeProperty
-
appendSelect
Description copied from interface:STreePropertyAppend to the select clause.- Specified by:
appendSelectin interfaceSTreeProperty
-
isMany
public boolean isMany() -
isAssignableFrom
-
loadIgnore
Description copied from interface:STreePropertyIgnore the property (moving the column index position without reading).- Specified by:
loadIgnorein interfaceSTreeProperty
-
load
Description copied from interface:STreePropertyLoad into the bean (from the DataReader/ResultSet).- Specified by:
loadin interfaceSTreeProperty
-
buildRawSqlSelectChain
Description copied from interface:STreePropertyFor RawSql build the select chain.- Specified by:
buildRawSqlSelectChainin interfaceSTreeProperty
-
read
- Specified by:
readin interfaceScalarDataReader<Object>- Throws:
SQLException
-
readSet
- Throws:
SQLException
-
read
- Throws:
SQLException
-
readSet
- Throws:
SQLException
-
bind
- Throws:
SQLException
-
writeData
- Throws:
IOException
-
readData
- Throws:
IOException
-
beanProperty
Description copied from interface:ElPropertyDeployReturn the underlying bean property.- Specified by:
beanPropertyin interfaceElPropertyDeploy
-
property
- Specified by:
propertyin interfaceExpressionPath
-
isLocal
public boolean isLocal()Return true is this type is not from a super type. -
setValueChanged
Set the changed value without invoking interception (lazy loading etc). Typically used to set generated values on update. -
addTenant
Add the tenantId predicate to the query. -
setTenantValue
Set the tenantId onto the bean. -
setValue
Set the value of the property without interception or PropertyChangeSupport. -
setValueIntercept
Set the value of the property. -
isCacheDataInclude
public boolean isCacheDataInclude()Return true if this property should be included in the cache bean data. -
getCacheDataValue
Return the value for this property which we hold in the L2 cache entry.This uses format() where possible to store the value as a string and this is done to make any resulting Java object serialisation content smaller as strings get special treatment.
-
getCacheDataValueOrig
Return the bean cache value for this property using original values. -
format
Return the value in String format (for bean cache key). -
parse
Return the value from String format into Object value. -
createMutableInfo
creates a mutableHash for the given JSON value. -
setCacheDataValue
Read the value for this property from L2 cache entry and set it to the bean.This uses parse() as per the comment in getCacheDataValue().
-
value
-
getValue
Return the value of the property method. -
getValueIntercept
-
convert
- Specified by:
convertin interfaceExpressionPath
-
pathSet
- Specified by:
pathSetin interfaceExpressionPath
-
pathGet
- Specified by:
pathGetin interfaceExpressionPath
-
pathGetNested
Description copied from interface:ElPropertyValueReturn the value ensuring objects prior to the top scalar property are automatically populated.- Specified by:
pathGetNestedin interfaceElPropertyValue
-
name
Return the name of the property.- Specified by:
namein interfaceElPropertyDeploy- Specified by:
namein interfaceProperty- Specified by:
namein interfaceSTreeProperty
-
propertyIndex
public int propertyIndex()Return the position of this property in the enhanced bean. -
elName
Description copied from interface:ElPropertyDeployThe ElPrefix plus name.- Specified by:
elNamein interfaceElPropertyDeploy- Specified by:
elNamein interfaceExpressionPath
-
containsFormulaWithJoin
public boolean containsFormulaWithJoin()Description copied from interface:ElPropertyDeployReturn true if the property is a formula with a join clause.- Specified by:
containsFormulaWithJoinin interfaceElPropertyDeploy
-
containsManySince
Description copied from interface:ElPropertyDeployReturn true if there is a property is on the path after sinceProperty that is a 'many' property.- Specified by:
containsManySincein interfaceElPropertyDeploy
-
containsMany
public boolean containsMany()Description copied from interface:ElPropertyDeployReturn true if there is a property on the path that is a many property.- Specified by:
containsManyin interfaceElPropertyDeploy- Specified by:
containsManyin interfaceExpressionPath
-
assocIsEmpty
Description copied from interface:ElPropertyValueReturn the logical where clause to support "Is empty".- Specified by:
assocIsEmptyin interfaceElPropertyValue
-
assocIdValues
- Specified by:
assocIdValuesin interfaceExpressionPath
-
assocIdExpression
- Specified by:
assocIdExpressionin interfaceExpressionPath
-
assocIdInExpr
Description copied from interface:ElPropertyValueReturn the logical id in expression taking into account embedded id's.- Specified by:
assocIdInExprin interfaceElPropertyValue
-
assocIdInValueExpr
Description copied from interface:ElPropertyValueReturn the logical id value expression taking into account embedded id's.- Specified by:
assocIdInValueExprin interfaceElPropertyValue
-
isImportedPrimaryKey
public boolean isImportedPrimaryKey()If true this bean maps to the primary key. -
isAssocMany
public boolean isAssocMany()Description copied from interface:ElPropertyValueReturn true if the property is a OneToMany or ManyToMany associated bean property.- Specified by:
isAssocManyin interfaceElPropertyValue
-
isAssocId
public boolean isAssocId()Description copied from interface:ElPropertyValueReturn true if this is an ManyToOne or OneToOne associated bean property.- Specified by:
isAssocIdin interfaceElPropertyValue- Specified by:
isAssocIdin interfaceExpressionPath
-
isAssocProperty
public boolean isAssocProperty()Description copied from interface:ElPropertyValueReturn true if any path of this path contains a Associated One or Many.- Specified by:
isAssocPropertyin interfaceElPropertyValue
-
elPlaceholder
Description copied from interface:ElPropertyDeployReturn the place holder in the form of ${elPrefix}dbColumn.The ${elPrefix} is replaced by the appropriate table alias.
- Specified by:
elPlaceholderin interfaceElPropertyDeploy
-
elPrefix
Description copied from interface:ElPropertyDeployReturn the prefix path of the property.This is use to determine joins required to support this property.
- Specified by:
elPrefixin interfaceElPropertyDeploy- Specified by:
elPrefixin interfaceSTreeProperty
-
fullName
Return the full name of this property.- Specified by:
fullNamein interfaceSTreeProperty
-
isArrayType
public boolean isArrayType() -
scalarType
Return the scalarType.- Specified by:
scalarTypein interfaceSTreeProperty
-
stringParser
- Specified by:
stringParserin interfaceExpressionPath
-
jdbcType
public int jdbcType()- Specified by:
jdbcTypein interfaceExpressionPath
-
dbLength
public int dbLength()Return the DB max length (varchar) or precision (decimal). -
dbScale
public int dbScale()Return the DB scale for numeric columns. -
dbColumnDefn
Return a specific column DDL definition if specified (otherwise null). -
dbCheckConstraintValues
Return the DB constraint expression (can be null).For an Enum returns IN expression for the set of Enum values.
-
renderDbType
Return the DB column type definition. -
dbColumnDefault
Return the DB column default to use for DDL. -
dbMigrationInfos
Return the DDL-Migration Infos -
generatedProperty
public io.ebeaninternal.server.deploy.generatedproperty.GeneratedProperty generatedProperty()Return the GeneratedValue. Used to generate update timestamp etc. -
isNaturalKey
public boolean isNaturalKey()Return true if this is the natural key property. -
isNullable
public boolean isNullable()Return true if this property is mandatory. -
isDDLNotNull
public boolean isDDLNotNull()Return true if DDL Not NULL constraint should be defined for this column based on it being a version column or having a generated property. -
isGenerated
public boolean isGenerated()Return true if this is a generated or Id property. -
isUnique
public boolean isUnique()Return true if the DB column should be unique. -
isTransient
public boolean isTransient()Return true if the property is transient. -
isLoadProperty
public boolean isLoadProperty()Return true if this property is loadable from a resultSet. -
isVersion
public boolean isVersion()Return true if this is a version column used for concurrency checking. -
dbColumn
The database column name this is mapped to.- Specified by:
dbColumnin interfaceElPropertyDeploy
-
dbComment
Return the comment for the associated DB column. -
dbType
public int dbType(boolean platformTypes) Return the database jdbc data type this is mapped to.- Parameters:
platformTypes- Set as false when we want logical platform agnostic types.
-
isFetchEager
public boolean isFetchEager()Return true if by default this property is set to fetch eager. Lob's usually default to fetch lazy. -
isLob
public boolean isLob()Return true if this is mapped to a Clob Blob LongVarchar or LongVarbinary. -
isLobForPlatform
public boolean isLobForPlatform()Returns true if thisisLob()or the type will effectively map to a lob.- Specified by:
isLobForPlatformin interfaceSTreeProperty
-
isLobType
public static boolean isLobType(int type) -
dbBind
Return the DB bind parameter. Typically is "?" but different for encrypted bind. -
localEncrypt
Description copied from interface:ElPropertyValueEncrypt the input value return the encrypted value.- Specified by:
localEncryptin interfaceElPropertyValue
-
isLocalEncrypted
public boolean isLocalEncrypted()Returns true if DB encrypted.- Specified by:
isLocalEncryptedin interfaceElPropertyValue
-
isDbEncrypted
public boolean isDbEncrypted()Return true if this property is stored encrypted.- Specified by:
isDbEncryptedin interfaceElPropertyValue
-
dbEncryptedType
public int dbEncryptedType() -
isExcludedFromHistory
public boolean isExcludedFromHistory()Return true if this property is excluded from history. -
isUnmappedJson
public boolean isUnmappedJson()Return true if this property hold unmapped JSON. -
isTenantId
public boolean isTenantId()Return true if this is the tenantId property (for multi-tenant partitioning). -
isSoftDelete
public boolean isSoftDelete()Return true if this property is the soft delete property. -
isDbInsertable
public boolean isDbInsertable()Return true if this property should be included in an Insert. -
isDbUpdatable
public boolean isDbUpdatable()Return true if this property should be included in an Update. -
isSecondaryTable
public boolean isSecondaryTable()Return true if this property is based on a secondary table (not the base table). -
type
Return the property type. -
isId
public boolean isId()Return true if this is included in the unique id.- Specified by:
isIdin interfaceSTreeProperty
-
isEmbedded
public boolean isEmbedded()Return true if this is an Embedded property. In this case it shares the table and primary key of its owner object.- Specified by:
isEmbeddedin interfaceSTreeProperty
-
toString
-
isJsonSerialize
public boolean isJsonSerialize() -
jsonWriteForInsert
JSON write the property for 'insert only depth'.- Throws:
IOException
-
jsonWriteValue
JSON write the property value.- Throws:
IOException
-
jsonWrite
JSON write the bean property.- Throws:
IOException
-
jsonRead
- Throws:
IOException
-
jsonRead
- Throws:
IOException
-
diff
Populate diff map comparing the property values between the beans. -
merge
-
registerColumn
-