Package com.axelor.db.mapper
Class Property
- java.lang.Object
-
- com.axelor.db.mapper.Property
-
- Direct Known Subclasses:
JsonProperty
public class Property extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
add(Object bean, Object item)
If this is a multi-valued field (one-to-many, many-to-many), add the specified item to the collection.Object
addAll(Object bean, Collection<?> items)
If this is a multi-valued field (one-to-many, many-to-many), add all the specified items to the collection.Object
clear(Object bean)
If this is a multi-valued field, clear the collection values.Object
get(Object bean)
Get the value of this property from the given bean instance.Class<?>
getEntity()
Class<?>
getEnumType()
Type
getGenericType()
String
getHelp()
Class<?>
getJavaType()
String
getMappedBy()
Object
getMaxSize()
Object
getMinSize()
String
getName()
String[]
getNameSearch()
int
getPrecision()
int
getScale()
String
getSelection()
String
getSequenceName()
Class<?>
getTarget()
String
getTargetName()
List<String>
getTargetSearch()
String
getTitle()
PropertyType
getType()
boolean
isCollection()
boolean
isCopyable()
boolean
isDefaultNow()
boolean
isEncrypted()
boolean
isEnum()
boolean
isEqualsInclude()
boolean
isHidden()
boolean
isImage()
boolean
isJson()
boolean
isMassUpdate()
boolean
isNameColumn()
boolean
isNullable()
boolean
isOrphan()
boolean
isPassword()
boolean
isPrimary()
boolean
isReadonly()
boolean
isReference()
boolean
isRequired()
boolean
isSequence()
boolean
isTransient()
boolean
isTranslatable()
boolean
isUnique()
boolean
isVersion()
boolean
isVirtual()
Object
set(Object bean, Object value)
Set the value for this property to the given bean instance.<T,U>
UsetAssociation(U child, T bean)
If this is a multi-valued field, ensure the proper parent-child relationship if association is bidirectional (marked with mappedBy attribute).protected void
setTarget(Class<?> target)
Map<String,Object>
toMap()
Create aMap
of property attributes.String
toString()
boolean
valueChanged(Object bean, Object oldValue)
Check whether the property value in the given bean is changed.
-
-
-
Method Detail
-
getEntity
public Class<?> getEntity()
-
getName
public String getName()
-
getType
public PropertyType getType()
-
getJavaType
public Class<?> getJavaType()
-
getGenericType
public Type getGenericType()
-
getMappedBy
public String getMappedBy()
-
getTarget
public Class<?> getTarget()
-
setTarget
protected void setTarget(Class<?> target)
-
getTargetName
public String getTargetName()
-
getEnumType
public Class<?> getEnumType()
-
isPrimary
public boolean isPrimary()
-
isVersion
public boolean isVersion()
-
isRequired
public boolean isRequired()
-
isUnique
public boolean isUnique()
-
isOrphan
public boolean isOrphan()
-
isEqualsInclude
public boolean isEqualsInclude()
-
isCopyable
public boolean isCopyable()
-
isVirtual
public boolean isVirtual()
-
isTransient
public boolean isTransient()
-
isJson
public boolean isJson()
-
isEnum
public boolean isEnum()
-
isPassword
public boolean isPassword()
-
isMassUpdate
public boolean isMassUpdate()
-
isReference
public boolean isReference()
-
isCollection
public boolean isCollection()
-
getMaxSize
public Object getMaxSize()
-
getMinSize
public Object getMinSize()
-
getPrecision
public int getPrecision()
-
getScale
public int getScale()
-
getTitle
public String getTitle()
-
getHelp
public String getHelp()
-
isImage
public boolean isImage()
-
isNullable
public boolean isNullable()
-
isReadonly
public boolean isReadonly()
-
isHidden
public boolean isHidden()
-
isSequence
public boolean isSequence()
-
isTranslatable
public boolean isTranslatable()
-
isEncrypted
public boolean isEncrypted()
-
isDefaultNow
public boolean isDefaultNow()
-
getSequenceName
public String getSequenceName()
-
isNameColumn
public boolean isNameColumn()
-
getNameSearch
public String[] getNameSearch()
-
getSelection
public String getSelection()
-
get
public Object get(Object bean)
Get the value of this property from the given bean instance.- Parameters:
bean
- the instance- Returns:
- value of the current property
-
set
public Object set(Object bean, Object value)
Set the value for this property to the given bean instance.If the property is a collection, ensure the proper parent-child relationship marked with mappedBy attribute.
- Parameters:
bean
- the bean instancevalue
- the value for the property- Returns:
- old value of the property
-
add
public Object add(Object bean, Object item)
If this is a multi-valued field (one-to-many, many-to-many), add the specified item to the collection.- Parameters:
bean
- the bean instanceitem
- collection item- Returns:
- the same bean instance
-
addAll
public Object addAll(Object bean, Collection<?> items)
If this is a multi-valued field (one-to-many, many-to-many), add all the specified items to the collection.- Parameters:
bean
- the bean instanceitems
- the items to add- Returns:
- the same bean instance
-
setAssociation
public <T,U> U setAssociation(U child, T bean)
If this is a multi-valued field, ensure the proper parent-child relationship if association is bidirectional (marked with mappedBy attribute).- Type Parameters:
T
- the type of the parentU
- the type of the child- Parameters:
child
- the child itembean
- the parent bean instance- Returns:
- the updated child instance
-
clear
public Object clear(Object bean)
If this is a multi-valued field, clear the collection values.- Parameters:
bean
- the bean instance- Returns:
- the same bean instance
-
valueChanged
public boolean valueChanged(Object bean, Object oldValue)
Check whether the property value in the given bean is changed.- Parameters:
bean
- the bean instance to checkoldValue
- the old value to check against- Returns:
- true if changed false otherwise
-
toMap
public Map<String,Object> toMap()
Create aMap
of property attributes. Transient and null valued attributes with be omitted.This method should be used to convert property to JSON format.
- Returns:
- map of property attributes
-
-