public class DefaultGrailsDomainClass extends AbstractGrailsClass implements GrailsDomainClass, ComponentCapableDomainClass
GORM, ORM_MAPPING
Constructor and Description |
---|
DefaultGrailsDomainClass(java.lang.Class<?> clazz)
Constructor.
|
DefaultGrailsDomainClass(java.lang.Class<?> clazz,
java.util.Map<java.lang.String,java.lang.Object> defaultConstraints)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addComponent(GrailsDomainClass component)
Adds a component
|
java.util.Map |
getAssociationMap()
Retrieves the association map
|
java.util.List<GrailsDomainClassProperty> |
getAssociations() |
java.util.List<GrailsDomainClass> |
getComponents()
Gets all the components for this domain class
|
java.util.Map |
getConstrainedProperties()
Returns a map of constraints applied to this domain class with the keys being the property name
and the values being ConstrainedProperty instances
|
java.lang.String |
getFieldName(java.lang.String propertyName)
Returns the field name for the given property name
|
GrailsDomainClassProperty |
getIdentifier()
Returns the identifier property
|
java.util.Map |
getMappedBy() |
java.lang.String |
getMappingStrategy() |
java.lang.String |
getName()
Returns the logical name of the class in the application without the trailing convention part if applicable
and without the package name.
|
GrailsDomainClassProperty[] |
getPersistantProperties()
Deprecated.
|
GrailsDomainClassProperty[] |
getPersistentProperties()
Returns all of the persistant properties of the domain class
|
GrailsDomainClassProperty |
getPersistentProperty(java.lang.String name)
Returns the property for the given name or null if non exists
|
GrailsDomainClassProperty[] |
getProperties()
Returns all of the properties of the domain class
|
GrailsDomainClassProperty |
getPropertyByName(java.lang.String name)
Returns the property for the given name
|
java.lang.String |
getPropertyName()
Returns the name of the class as a property name.
|
java.lang.Class<?> |
getRelatedClassType(java.lang.String propertyName)
Returns the type of the related class of the given property
|
java.util.Set |
getSubClasses()
Returns the sub-classes for this class if any
|
Validator |
getValidator()
Retreives the validator for this domain class
|
GrailsDomainClassProperty |
getVersion()
Returns the version property
|
boolean |
hasPersistentProperty(java.lang.String propertyName)
Returns true if this domain class has a persistent property for the given name
|
boolean |
hasSubClasses()
Returns true if the domain classes has sub classes
|
boolean |
isBidirectional(java.lang.String propertyName)
Returns true if the given property is a bi-directional relationship
|
boolean |
isManyToOne(java.lang.String propertyName)
Returns true if the given property is a many to one relationship
|
boolean |
isOneToMany(java.lang.String propertyName)
Returns true if the given property is a one to many relationship
|
boolean |
isOwningClass(java.lang.Class domainClass) |
boolean |
isRoot()
Whether the class is the root of a heirarchy
|
void |
refreshConstraints()
Refreshes the constraint defined on a domain class
|
void |
setMappingStrategy(java.lang.String strategy)
Sets the strategy to use for ORM mapping.
|
void |
setValidator(Validator validator)
Sets the validator for this domain class
|
getClazz, getFullName, getGrailsApplication, getLogicalPropertyName, getMetaClass, getNaturalName, getPackageName, getPropertyDescriptors, getPropertyType, getPropertyValue, getPropertyValue, getPropertyValueObject, getReference, getReferenceInstance, getShortName, getStaticPropertyValue, hasMetaMethod, hasMetaMethod, hasMetaProperty, hasProperty, isAbstract, isActionMethod, isReadableProperty, newInstance, setGrailsApplication, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getClazz, getFullName, getGrailsApplication, getLogicalPropertyName, getMetaClass, getNaturalName, getPackageName, getPropertyValue, getPropertyValue, getReference, getReferenceInstance, getShortName, hasProperty, isAbstract, newInstance
setGrailsApplication
public DefaultGrailsDomainClass(java.lang.Class<?> clazz, java.util.Map<java.lang.String,java.lang.Object> defaultConstraints)
clazz
- defaultConstraints
- public DefaultGrailsDomainClass(java.lang.Class<?> clazz)
clazz
- public boolean hasSubClasses()
GrailsDomainClass
hasSubClasses
in interface GrailsDomainClass
public java.util.Map getAssociationMap()
getAssociationMap
in interface GrailsDomainClass
public boolean isOwningClass(java.lang.Class domainClass)
isOwningClass
in interface GrailsDomainClass
public GrailsDomainClassProperty[] getProperties()
GrailsDomainClass
getProperties
in interface GrailsDomainClass
public GrailsDomainClassProperty getIdentifier()
GrailsDomainClass
getIdentifier
in interface GrailsDomainClass
public GrailsDomainClassProperty getVersion()
GrailsDomainClass
getVersion
in interface GrailsDomainClass
@Deprecated public GrailsDomainClassProperty[] getPersistantProperties()
GrailsDomainClass
getPersistantProperties
in interface GrailsDomainClass
GrailsDomainClass.getPersistantProperties()
public GrailsDomainClassProperty[] getPersistentProperties()
GrailsDomainClass
getPersistentProperties
in interface GrailsDomainClass
public GrailsDomainClassProperty getPropertyByName(java.lang.String name)
GrailsDomainClass
getPropertyByName
in interface GrailsDomainClass
name
- The property for the namepublic GrailsDomainClassProperty getPersistentProperty(java.lang.String name)
GrailsDomainClass
getPersistentProperty
in interface GrailsDomainClass
name
- The property namepublic java.lang.String getFieldName(java.lang.String propertyName)
GrailsDomainClass
getFieldName
in interface GrailsDomainClass
public java.lang.String getName()
GrailsClass
getName
in interface GrailsClass
getName
in class AbstractGrailsClass
public boolean isOneToMany(java.lang.String propertyName)
GrailsDomainClass
isOneToMany
in interface GrailsDomainClass
propertyName
- The name of the propertypublic boolean isManyToOne(java.lang.String propertyName)
GrailsDomainClass
isManyToOne
in interface GrailsDomainClass
propertyName
- The name of the propertypublic java.lang.Class<?> getRelatedClassType(java.lang.String propertyName)
GrailsDomainClass
getRelatedClassType
in interface GrailsDomainClass
propertyName
- The name of the propertypublic java.lang.String getPropertyName()
GrailsClass
getPropertyName
in interface GrailsClass
getPropertyName
in interface GrailsDomainClass
getPropertyName
in class AbstractGrailsClass
public boolean isBidirectional(java.lang.String propertyName)
GrailsDomainClass
isBidirectional
in interface GrailsDomainClass
propertyName
- The name of the propertypublic java.util.Map getConstrainedProperties()
GrailsDomainClass
getConstrainedProperties
in interface GrailsDomainClass
public Validator getValidator()
GrailsDomainClass
getValidator
in interface GrailsDomainClass
public void setValidator(Validator validator)
GrailsDomainClass
setValidator
in interface GrailsDomainClass
validator
- The domain class validator to setpublic java.lang.String getMappingStrategy()
getMappingStrategy
in interface GrailsDomainClass
public boolean isRoot()
GrailsDomainClass
isRoot
in interface GrailsDomainClass
public java.util.Set getSubClasses()
GrailsDomainClass
getSubClasses
in interface GrailsDomainClass
public void refreshConstraints()
GrailsDomainClass
refreshConstraints
in interface GrailsDomainClass
public java.util.Map getMappedBy()
getMappedBy
in interface GrailsDomainClass
public boolean hasPersistentProperty(java.lang.String propertyName)
GrailsDomainClass
hasPersistentProperty
in interface GrailsDomainClass
propertyName
- The property namepublic void setMappingStrategy(java.lang.String strategy)
GrailsDomainClass
setMappingStrategy
in interface GrailsDomainClass
strategy
- The mapping strategypublic void addComponent(GrailsDomainClass component)
ComponentCapableDomainClass
addComponent
in interface ComponentCapableDomainClass
component
- The componentpublic java.util.List<GrailsDomainClass> getComponents()
ComponentCapableDomainClass
getComponents
in interface ComponentCapableDomainClass
public java.util.List<GrailsDomainClassProperty> getAssociations()