public class StringProperty extends Property implements SQLPropertyInfo, ESPropertyInfo
Modifier and Type | Class and Description |
---|---|
static class |
StringProperty.Factory
Factory for generating properties based on their field type
|
accessPath, alternativePropertyKey, defaultValue, descriptor, field, label, length, name, nameAsMapping, nullable, propertyKey, propertyName
Modifier and Type | Method and Description |
---|---|
void |
contributeToTable(Table table)
Appends columns, keys and foreign keys to the given table to match the settings specified by
this property
|
void |
describeProperty(com.alibaba.fastjson.JSONObject description)
Creates the mapping description for this property into the given JSON.
|
void |
onBeforeSaveChecks(Object entity)
Invoked before an entity is written to the database.
|
protected void |
setValueFromDatasource(Class<? extends BaseMapper<?,?,?>> mapperType,
Object entity,
sirius.kernel.commons.Value data)
Applies the given database value to the given entity.
|
protected void |
setValueToField(Object value,
Object target)
Applies the given value to the field in the given target object
|
protected Object |
transformToDatasource(Class<? extends BaseMapper<?,?,?>> mapperType,
Object object)
Converts the Java object which resides in the associated field to the database value which is to be
written into the database.
|
Object |
transformValue(sirius.kernel.commons.Value value)
Converts the given value, which most probably contains user input as string into the target type of this
property.
|
checkNullability, checkUniqueness, determineDefaultValue, determineLengths, determineNullability, equals, getAnnotation, getDefaultValue, getDefinition, getDescriptor, getField, getLabel, getLength, getName, getPropertyName, getValue, getValueAsCopy, getValueForDatasource, getValueFromField, hashCode, illegalFieldValue, isNullable, link, onAfterDelete, onAfterSave, onBeforeDelete, onBeforeSave, parseValue, setValue, toString, transformFromDatasource, transformFromElastic, transformFromJDBC, transformFromMongo, transformToElastic, transformToJDBC, transformToMongo
is, makeNewInstance, tryAs
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
transferOption
protected Object transformToDatasource(Class<? extends BaseMapper<?,?,?>> mapperType, Object object)
Property
transformToDatasource
in class Property
mapperType
- the mapper which is currently active. This can be used to determine which kind of database is
active and therefore which data format will be required.object
- the current field valueprotected void setValueFromDatasource(Class<? extends BaseMapper<?,?,?>> mapperType, Object entity, sirius.kernel.commons.Value data)
Property
The internal access path will be used to find the target object which contains the field.
If the underlying field of this property is primitive, but the given value is null or transformed to null, this will be ignored. An scenario like this might happen, if we join-fetch a value, which is not present.
setValueFromDatasource
in class Property
mapperType
- the mapper which is currently active. This can be used to determine which kind of database is
active and therefore which data format will be available.entity
- the entity to write todata
- the database value to storeprotected void setValueToField(Object value, Object target)
Property
setValueToField
in class Property
value
- the database value to storetarget
- the target object determined by the access pathpublic Object transformValue(sirius.kernel.commons.Value value)
Property
transformValue
in class Property
value
- the value to convertpublic void onBeforeSaveChecks(Object entity)
Property
This method is intended to be overwritten with custom logic.
onBeforeSaveChecks
in class Property
entity
- the entity to checkpublic void contributeToTable(Table table)
SQLPropertyInfo
contributeToTable
in interface SQLPropertyInfo
table
- the table to add schema infos topublic void describeProperty(com.alibaba.fastjson.JSONObject description)
ESPropertyInfo
describeProperty
in interface ESPropertyInfo
description
- the target JSON to fillCopyright © 2018. All rights reserved.