## org.codehaus.groovy.grails.commons
Interface GrailsDomainClassProperty

All Known Implementing Classes:
  DefaultGrailsDomainClassProperty, GrailsHibernateDomainClassProperty

    public interface GrailsDomainClassProperty

A property of a GrailsDomainClass instance

Since:
  Jul 5, 2005
Author:
  Graeme Rocher

Field Summary
`static String` `BELONGS_TO`
`static String` `CLASS`
`static String` `CONSTRAINTS`
`static String` `DATE_CREATED`
`static String` `EMBEDDED`
`static String` `EVANESCENT`
`static int` `FETCH_EAGER`
`static int` `FETCH_LAZY`
`static String` `FETCH_MODE`
`static String` `HAS_MANY`
`static String` `IDENTITY`
`static String` `LAST_UPDATED`
`static String` `MAPPED_BY`
`static String` `MAPPING`
`static String` `MAPPING_STRATEGY`
`static String` `META_CLASS`
`static String` `RELATES_TO_MANY`
`static String` `SORT`
`static String` `TRANSIENT`
`static String` `VERSION`

Method Summary
`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
`String` `getFieldName()` Returns the domain field name for this property
`String` `getName()` Returns the name of the property
`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
`String` `getReferencedPropertyName()` Retrieves the name of property referenced by this property if it is an association and is known, otherwise null
`Class` `getReferencedPropertyType()` Returns the referenced property type.
`Class` `getType()` Returns the type for the domain class
`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` `isEmbedded()` Returns true if this propert is an embedded component
`boolean` `isEnum()` Returns true if this properties type is an enum
`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 true 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` `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

### IDENTITY

    static final String IDENTITY

See Also:
  Constant Field Values

### VERSION

    static final String VERSION

See Also:
  Constant Field Values

### TRANSIENT

    static final String TRANSIENT

See Also:
  Constant Field Values

### CONSTRAINTS

    static final String CONSTRAINTS

See Also:
  Constant Field Values

### EVANESCENT

    static final String EVANESCENT

See Also:
  Constant Field Values

### RELATES_TO_MANY

    static final String RELATES_TO_MANY

See Also:
  Constant Field Values

### META_CLASS

    static final String META_CLASS

See Also:
  Constant Field Values

### CLASS

    static final String CLASS

See Also:
  Constant Field Values

### MAPPING_STRATEGY

    static final String MAPPING_STRATEGY

See Also:
  Constant Field Values

### MAPPED_BY

    static final String MAPPED_BY

See Also:
  Constant Field Values

### BELONGS_TO

    static final String BELONGS_TO

See Also:
  Constant Field Values

### HAS_MANY

    static final String HAS_MANY

See Also:
  Constant Field Values

### FETCH_MODE

    static final String FETCH_MODE

See Also:
  Constant Field Values

### DATE_CREATED

    static final String DATE_CREATED

See Also:
  Constant Field Values

### MAPPING

    static final String MAPPING

See Also:
  Constant Field Values

### LAST_UPDATED

    static final String LAST_UPDATED

See Also:
  Constant Field Values

### SORT

    static final String SORT

See Also:
  Constant Field Values

### EMBEDDED

    static final String EMBEDDED

See Also:
  Constant Field Values

### FETCH_EAGER

    static final int FETCH_EAGER

See Also:
  Constant Field Values

### FETCH_LAZY

    static final int FETCH_LAZY

See Also:
  Constant Field Values

Method Detail

### getFetchMode

    int getFetchMode()

  Returns the configured fetch mode for the property

### getName

    String getName()

  Returns the name of the property

  Returns:
    The property name

### getType

    Class getType()

  Returns the type for the domain class

  Returns:
    The property type

### getReferencedPropertyType

    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

### getOtherSide

    GrailsDomainClassProperty getOtherSide()

  Returns the other side of a bidirectional association

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

### getTypePropertyName

    String getTypePropertyName()

  Returns the class type as a property name representation

  Returns:
    The property name representation

### getDomainClass

    GrailsDomainClass getDomainClass()

  Returns the parent domain class of the property instance

  Returns:
    The parent domain class

### isPersistent

    boolean isPersistent()

  Returns true if the domain class property is a persistent property

  Returns:
    Whether the property is persistent

### isOptional

    boolean isOptional()

  Returns true if the property is required

  Returns:
    Whether the property is optional

### isIdentity

    boolean isIdentity()

  Returns true of the property is an identifier

  Returns:
    Whether the property is the identifier

### isOneToMany

    boolean isOneToMany()

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

  Returns:
    Whether it is a oneToMany

### isManyToOne

    boolean isManyToOne()

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

  Returns:
    Whether it is a manyToOne

### isManyToMany

    boolean isManyToMany()

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

  Returns:
    True if it is a manyToMany

### isBidirectional

    boolean isBidirectional()

  Returns true if the property is a bi-directional relationship

  Returns:
    A boolean value

### getFieldName

    String getFieldName()

  Returns the domain field name for this property

### isOneToOne

    boolean isOneToOne()

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

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

### getReferencedDomainClass

    GrailsDomainClass getReferencedDomainClass()

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

  Returns:
    The GrailsDomainClass

### isAssociation

    boolean isAssociation()

  Returns true if this property is a relationship property

  Returns:
    True if it is an associative property

### isEnum

    boolean isEnum()

  Returns true if this properties type is an enum

  Returns:
    True if it is

### getNaturalName

    String getNaturalName()

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

### setReferencedDomainClass

    void setReferencedDomainClass(GrailsDomainClass referencedGrailsDomainClass)

  Sets the references domain class on the property

  Parameters:
    `referencedGrailsDomainClass` -

### setOtherSide

    void setOtherSide(GrailsDomainClassProperty referencedProperty)

  Sets the other side of an associative property

  Parameters:
    `referencedProperty` -

### isInherited

    boolean isInherited()

  Whether the property is inherited from a super class

  Returns:
    True if its inherited

### isOwningSide

    boolean isOwningSide()

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

  Returns:
    True if it is the owning side

### isCircular

    boolean isCircular()

  Whether the relationship is cirucular

  Returns:
    True if it is

### getReferencedPropertyName

    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

### isEmbedded

    boolean isEmbedded()

  Returns true if this propert is an embedded component

  Returns:
    True if it is, false otherwise

### getComponent

    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

  Returns:
    The component or null if it is not an embedded component
  See Also:
    `GrailsDomainClass`, `isEmbedded()`

### setOwningSide

    void setOwningSide(boolean b)

### isBasicCollectionType

    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

Copyright (c) 2005-2009 The Grails project