Package: grails.core

## [Java] Interface GrailsDomainClassProperty

- A property of a GrailsDomainClass instance.

  deprecated:
    Use the org.grails.datastore.mapping.model.MappingContext API instead
  Authors:
    Graeme Rocher

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `java.lang.String` | `ALL_DATA_SOURCES` |
    `java.lang.String` | `ATTACHED` |
    `java.lang.String` | `BELONGS_TO` |
    `java.lang.String` | `CLASS` |
    `java.lang.String` | `CONSTRAINTS` |
    `java.lang.String` | `DATE_CREATED` |
    `java.lang.String` | `DEFAULT_DATA_SOURCE` |
    `java.lang.String` | `DIRTY` |
    `java.lang.String` | `DIRTY_PROPERTY_NAMES` |
    `java.lang.String` | `DOMAIN_CLASS` |
    `java.lang.String` | `EMBEDDED` |
    `java.lang.String` | `ERRORS` |
    `int` | `FETCH_EAGER` |
    `int` | `FETCH_LAZY` |
    `java.lang.String` | `FETCH_MODE` |
    `java.lang.String` | `HAS_MANY` |
    `java.lang.String` | `HAS_ONE` |
    `java.lang.String` | `IDENTITY` |
    `java.lang.String` | `LAST_UPDATED` |
    `java.lang.String` | `MAPPED_BY` |
    `java.lang.String` | `MAPPING` |
    `java.lang.String` | `MAPPING_STRATEGY` |
    `java.lang.String` | `META_CLASS` |
    `java.lang.String` | `NAMED_QUERIES` |
    `java.lang.String` | `SORT` |
    `java.lang.String` | `TRANSIENT` |
    `java.lang.String` | `VERSION` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `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()` Returns: The natural name representation of the property (eg.
    `` | `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` | `setDerived(boolean derived)`
    `` | `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'.
    `` | `void` | `setOtherSide(GrailsDomainClassProperty referencedProperty)` Sets the other side of an associative property.
    `` | `void` | `setOwningSide(boolean b)`
    `` | `void` | `setReferencedDomainClass(GrailsDomainClass referencedGrailsDomainClass)` Sets the references domain class on the property.

- - ### Field Detail

    - #### public java.lang.String ALL_DATA_SOURCES

    - #### public java.lang.String ATTACHED

    - #### public java.lang.String BELONGS_TO

    - #### public java.lang.String CLASS

    - #### public java.lang.String CONSTRAINTS

    - #### public java.lang.String DATE_CREATED

    - #### public java.lang.String DEFAULT_DATA_SOURCE

    - #### public java.lang.String DIRTY

    - #### public java.lang.String DIRTY_PROPERTY_NAMES

    - #### public java.lang.String DOMAIN_CLASS

    - #### public java.lang.String EMBEDDED

    - #### public java.lang.String ERRORS

    - #### public int FETCH_EAGER

    - #### public int FETCH_LAZY

    - #### public java.lang.String FETCH_MODE

    - #### public java.lang.String HAS_MANY

    - #### public java.lang.String HAS_ONE

    - #### public java.lang.String IDENTITY

    - #### public java.lang.String LAST_UPDATED

    - #### public java.lang.String MAPPED_BY

    - #### public java.lang.String MAPPING

    - #### public java.lang.String MAPPING_STRATEGY

    - #### public java.lang.String META_CLASS

    - #### public java.lang.String NAMED_QUERIES

    - #### public java.lang.String SORT

    - #### public java.lang.String TRANSIENT

    - #### public java.lang.String VERSION

  - ### Method Detail

    - #### public 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.

      See Also:
        GrailsDomainClass
        GrailsDomainClassProperty.isEmbedded
      Returns:
        The component or null if it is not an embedded component

    - #### public GrailsDomainClass getDomainClass()

      Returns the parent domain class of the property instance.

      Returns:
        The parent domain class

    - #### public int getFetchMode()

      Returns the configured fetch mode for the property

    - #### public java.lang.String getFieldName()

      Returns the domain field name for this property.

    - #### public java.lang.String getName()

      Returns the name of the property.

      Returns:
        The property name

    - #### public java.lang.String getNaturalName()

      Returns:
        The natural name representation of the property (eg. 'lastName' becomes 'Last Name'

    - #### public GrailsDomainClassProperty getOtherSide()

      Returns the other side of a bidirectional association

      Returns:
        The other side of the relationship or null if not known

    - #### public GrailsDomainClass getReferencedDomainClass()

      Returns the GrailsDomainClass of a relationship property or null, if the property is not a relationship property.

      Returns:
        The GrailsDomainClass

    - #### public java.lang.String getReferencedPropertyName()

      Retrieves the name of property referenced by this property if it is an association and is known, otherwise null.

      Returns:
        The name of the prop

    - #### @java.lang.SuppressWarnings("rawtypes") public java.lang.Class getReferencedPropertyType()

      Returns the referenced property type. This differs from getType() in that in the case of an Association it will return the type of the elements contained within the Collection, otherwise it will delegate to getType();

      Returns:
        The referenced type

    - #### @java.lang.SuppressWarnings("rawtypes") public java.lang.Class getType()

      Returns the type for the domain class

      Returns:
        The property type

    - #### public java.lang.String getTypePropertyName()

      Returns the class type as a property name representation.

      Returns:
        The property name representation

    - #### public boolean isAssociation()

      Returns true if this property is a relationship property.

      Returns:
        true if it is an associative property

    - #### public boolean isBasicCollectionType()

      Return whether this is a collection of basic types like String, Integer etc.

      Returns:
        true if it is a collection of basic types

    - #### public boolean isBidirectional()

      Returns true if the property is a bi-directional relationship.

      Returns:
        A boolean value

    - #### public boolean isCircular()

      Whether the relationship is cirucular.

      Returns:
        true if it is

    - #### public boolean isDerived()

    - #### public boolean isEmbedded()

      Returns true if this propert is an embedded component.

      Returns:
        true if it is, false otherwise

    - #### public boolean isEnum()

      Returns true if this properties type is an enum.

      Returns:
        true if it is

    - #### public boolean isExplicitSaveUpdateCascade()

      Check whether this property is set up to receive save-update cascading via the Mapping DSL rather than using 'belongsTo'.

      Returns:
        True if this property is explicitly defined to receive save and update cascades, false otherwise.

    - #### public boolean isHasOne()

    - #### public boolean isIdentity()

      Returns true of the property is an identifier.

      Returns:
        Whether the property is the identifier

    - #### public boolean isInherited()

      Whether the property is inherited from a super class.

      Returns:
        true if its inherited

    - #### public boolean isManyToMany()

      Returns true if the property is a many-to-many relationship.

      Returns:
        true if it is a manyToMany

    - #### public boolean isManyToOne()

      Returns true if the property is a many-to-one relationship.

      Returns:
        Whether it is a manyToOne

    - #### public boolean isOneToMany()

      Returns true if the property is a one-to-many relationship.

      Returns:
        Whether it is a oneToMany

    - #### public boolean isOneToOne()

      Returns true if the property is a one-to-one relationship.

      Returns:
        true if it is a one-to-one relationship

    - #### public boolean isOptional()

      Returns false if the property is required.

      Returns:
        Whether the property is optional

    - #### public boolean isOwningSide()

      Whether this side of the association is the "owning" side.

      Returns:
        true if it is the owning side

    - #### public boolean isPersistent()

      Returns true if the domain class property is a persistent property.

      Returns:
        Whether the property is persistent

    - #### public void setDerived(boolean derived)

    - #### public 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'. Specifically, the cascades will have been set up via the Mapping DSL.

      Parameters:
        `explicitSaveUpdateCascade` - Whether this property is explicity defined, via the mapping DSL, to receive save and update cascades.

    - #### public void setOtherSide(GrailsDomainClassProperty referencedProperty)

      Sets the other side of an associative property.

      Parameters:
        referencedProperty

    - #### public void setOwningSide(boolean b)

    - #### public void setReferencedDomainClass(GrailsDomainClass referencedGrailsDomainClass)

      Sets the references domain class on the property.

      Parameters:
        referencedGrailsDomainClass