public class DefaultGrailsDomainClassProperty extends java.lang.Object implements GrailsDomainClassProperty
ALL_DATA_SOURCES, ATTACHED, BELONGS_TO, CLASS, CONSTRAINTS, DATE_CREATED, DEFAULT_DATA_SOURCE, DIRTY, DIRTY_PROPERTY_NAMES, DOMAIN_CLASS, EMBEDDED, ERRORS, EVANESCENT, FETCH_EAGER, FETCH_LAZY, FETCH_MODE, HAS_MANY, HAS_ONE, IDENTITY, LAST_UPDATED, MAPPED_BY, MAPPING, MAPPING_STRATEGY, META_CLASS, NAMED_QUERIES, RELATES_TO_MANY, SORT, TRANSIENT, VERSION| Constructor and Description |
|---|
DefaultGrailsDomainClassProperty(GrailsDomainClass domainClass,
java.beans.PropertyDescriptor descriptor)
Constructor.
|
DefaultGrailsDomainClassProperty(GrailsDomainClass domainClass,
java.beans.PropertyDescriptor descriptor,
java.util.Map<java.lang.String,java.lang.Object> defaultConstraints)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o)
Overriddent equals to take into account inherited properties
e.g.
|
GrailsDomainClass |
getComponent()
If #isEmbedded returns true then this method can be called to obtain a reference to the
embedded component, which implements the GrailsDomainClass interface.
|
GrailsDomainClass |
getDomainClass()
Returns the parent domain class of the property instance.
|
int |
getFetchMode()
Returns the configured fetch mode for the property
|
java.lang.String |
getFieldName()
Returns the domain field name for this property.
|
java.lang.String |
getName()
Returns the name of the property.
|
java.lang.String |
getNaturalName() |
GrailsDomainClassProperty |
getOtherSide()
Returns the other side of a bidirectional association
|
GrailsDomainClass |
getReferencedDomainClass()
Returns the GrailsDomainClass of a relationship property or null,
if the property is not a relationship property.
|
java.lang.String |
getReferencedPropertyName()
Retrieves the name of property referenced by this property if it is
an association and is known, otherwise null.
|
java.lang.Class |
getReferencedPropertyType()
Returns the referenced property type.
|
java.lang.Class |
getType()
Returns the type for the domain class
|
java.lang.String |
getTypePropertyName()
Returns the class type as a property name representation.
|
boolean |
isAssociation()
Returns true if this property is a relationship property.
|
boolean |
isBasicCollectionType()
Return whether this is a collection of basic types like String, Integer etc.
|
boolean |
isBidirectional()
Returns true if the property is a bi-directional relationship.
|
boolean |
isCircular()
Whether the relationship is cirucular.
|
boolean |
isDerived() |
boolean |
isEmbedded()
Returns true if this propert is an embedded component.
|
boolean |
isEnum()
Returns true if this properties type is an enum.
|
boolean |
isExplicitSaveUpdateCascade()
Check whether this property is set up to receive save-update cascading via the Mapping DSL rather than
using 'belongsTo'.
|
boolean |
isHasOne() |
boolean |
isIdentity()
Returns true of the property is an identifier.
|
boolean |
isInherited()
Whether the property is inherited from a super class.
|
boolean |
isManyToMany()
Returns true if the property is a many-to-many relationship.
|
boolean |
isManyToOne()
Returns true if the property is a many-to-one relationship.
|
boolean |
isOneToMany()
Returns true if the property is a one-to-many relationship.
|
boolean |
isOneToOne()
Returns true if the property is a one-to-one relationship.
|
boolean |
isOptional()
Returns false if the property is required.
|
boolean |
isOwningSide()
Whether this side of the association is the "owning" side.
|
boolean |
isPersistent()
Returns true if the domain class property is a persistent property.
|
void |
setBasicCollectionType(boolean b) |
protected void |
setBidirectional(boolean bidirectional)
Sets whether the relationship is bidirectional or not
|
void |
setDerived(boolean derived) |
void |
setEmbedded(boolean isEmbedded) |
void |
setExplicitSaveUpdateCascade(boolean explicitSaveUpdateCascade)
Sets whether the domain class property is explicitly set up to receive
save and update cascades via a means other than 'belongsTo'.
|
protected void |
setHasOne(boolean isHasOne)
Set whether the foreign key is stored in the parent or child in a one-to-one
|
void |
setIdentity(boolean b) |
protected void |
setManyToMany(boolean manyToMany) |
protected void |
setManyToOne(boolean manyToOne) |
protected void |
setOneToMany(boolean oneToMany) |
protected void |
setOneToOne(boolean oneToOne) |
void |
setOtherSide(GrailsDomainClassProperty property)
Sets the other side of an associative property.
|
void |
setOwningSide(boolean b) |
protected void |
setPersistent(boolean persistent) |
void |
setReferencedDomainClass(GrailsDomainClass referencedDomainClass)
Sets the references domain class on the property.
|
protected void |
setReferencedPropertyType(java.lang.Class<?> referencedPropertyType)
Sets the referenced property type of this property
|
void |
setReferencePropertyName(java.lang.String name) |
java.lang.String |
toString() |
public DefaultGrailsDomainClassProperty(GrailsDomainClass domainClass, java.beans.PropertyDescriptor descriptor)
domainClass - descriptor - public DefaultGrailsDomainClassProperty(GrailsDomainClass domainClass, java.beans.PropertyDescriptor descriptor, java.util.Map<java.lang.String,java.lang.Object> defaultConstraints)
domainClass - descriptor - public java.lang.String getName()
GrailsDomainClassPropertygetName in interface GrailsDomainClassPropertypublic java.lang.Class getType()
GrailsDomainClassPropertygetType in interface GrailsDomainClassPropertypublic boolean isPersistent()
GrailsDomainClassPropertyisPersistent in interface GrailsDomainClassPropertypublic boolean isOptional()
GrailsDomainClassPropertyisOptional in interface GrailsDomainClassPropertypublic boolean isIdentity()
GrailsDomainClassPropertyisIdentity in interface GrailsDomainClassPropertypublic void setIdentity(boolean b)
public boolean isOneToMany()
GrailsDomainClassPropertyisOneToMany in interface GrailsDomainClassPropertypublic boolean isManyToOne()
GrailsDomainClassPropertyisManyToOne in interface GrailsDomainClassPropertypublic java.lang.String getFieldName()
GrailsDomainClassPropertygetFieldName in interface GrailsDomainClassPropertypublic boolean isOneToOne()
GrailsDomainClassPropertyisOneToOne in interface GrailsDomainClassPropertypublic GrailsDomainClass getDomainClass()
GrailsDomainClassPropertygetDomainClass in interface GrailsDomainClassPropertypublic boolean isManyToMany()
GrailsDomainClassPropertyisManyToMany in interface GrailsDomainClassPropertyprotected void setManyToMany(boolean manyToMany)
manyToMany - The manyToMany to set.protected void setOneToMany(boolean oneToMany)
oneToMany - The oneToMany to set.protected void setManyToOne(boolean manyToOne)
manyToOne - The manyToOne to set.protected void setOneToOne(boolean oneToOne)
oneToOne - The oneToOne to set.protected void setHasOne(boolean isHasOne)
isHasOne - True if its stored in the parentpublic boolean isHasOne()
isHasOne in interface GrailsDomainClassPropertyprotected void setPersistent(boolean persistent)
persistent - The persistant to set.protected void setBidirectional(boolean bidirectional)
public java.lang.String getTypePropertyName()
GrailsDomainClassPropertygetTypePropertyName in interface GrailsDomainClassPropertypublic java.lang.Class getReferencedPropertyType()
GrailsDomainClassPropertygetReferencedPropertyType in interface GrailsDomainClassPropertypublic boolean isBidirectional()
GrailsDomainClassPropertyisBidirectional in interface GrailsDomainClassPropertyprotected void setReferencedPropertyType(java.lang.Class<?> referencedPropertyType)
public GrailsDomainClass getReferencedDomainClass()
GrailsDomainClassPropertygetReferencedDomainClass in interface GrailsDomainClassPropertypublic void setReferencedDomainClass(GrailsDomainClass referencedDomainClass)
GrailsDomainClassPropertysetReferencedDomainClass in interface GrailsDomainClassPropertypublic boolean isAssociation()
GrailsDomainClassPropertyisAssociation in interface GrailsDomainClassPropertypublic boolean isEnum()
GrailsDomainClassPropertyisEnum in interface GrailsDomainClassPropertypublic java.lang.String getNaturalName()
getNaturalName in interface GrailsDomainClassPropertypublic java.lang.String toString()
toString in class java.lang.Objectpublic GrailsDomainClassProperty getOtherSide()
GrailsDomainClassPropertygetOtherSide in interface GrailsDomainClassPropertypublic void setOtherSide(GrailsDomainClassProperty property)
GrailsDomainClassPropertysetOtherSide in interface GrailsDomainClassPropertypublic boolean isExplicitSaveUpdateCascade()
GrailsDomainClassPropertyisExplicitSaveUpdateCascade in interface GrailsDomainClassPropertypublic void setExplicitSaveUpdateCascade(boolean explicitSaveUpdateCascade)
GrailsDomainClassPropertysetExplicitSaveUpdateCascade in interface GrailsDomainClassPropertyexplicitSaveUpdateCascade - Whether this property is explicity defined, via
the mapping DSL, to receive save and update cascades.public boolean isInherited()
GrailsDomainClassPropertyisInherited in interface GrailsDomainClassPropertypublic int getFetchMode()
GrailsDomainClassPropertygetFetchMode in interface GrailsDomainClassPropertypublic boolean isOwningSide()
GrailsDomainClassPropertyisOwningSide in interface GrailsDomainClassPropertypublic void setOwningSide(boolean b)
setOwningSide in interface GrailsDomainClassPropertypublic boolean isCircular()
GrailsDomainClassPropertyisCircular in interface GrailsDomainClassPropertypublic void setReferencePropertyName(java.lang.String name)
public java.lang.String getReferencedPropertyName()
GrailsDomainClassPropertygetReferencedPropertyName in interface GrailsDomainClassPropertypublic boolean isEmbedded()
GrailsDomainClassPropertyisEmbedded in interface GrailsDomainClassPropertypublic GrailsDomainClass getComponent()
GrailsDomainClassPropertygetComponent in interface GrailsDomainClassPropertyGrailsDomainClass,
GrailsDomainClassProperty.isEmbedded()public void setEmbedded(boolean isEmbedded)
public boolean isDerived()
isDerived in interface GrailsDomainClassPropertypublic void setDerived(boolean derived)
setDerived in interface GrailsDomainClassPropertypublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the Object to compare this property topublic void setBasicCollectionType(boolean b)
public boolean isBasicCollectionType()
GrailsDomainClassPropertyisBasicCollectionType in interface GrailsDomainClassProperty