## org.codehaus.groovy.grails.orm.hibernate
Class GrailsHibernateDomainClassProperty

    java.lang.Object
      org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateDomainClassProperty

All Implemented Interfaces:
  GrailsDomainClassProperty

    public class GrailsHibernateDomainClassProperty

extends Object
implements GrailsDomainClassProperty

An implementation of the GrailsDomainClassProperty interface that allows Classes mapped in Hibernate to integrate with Grails' validation, dynamic methods etc. seamlessly

Since:
  0.1 Created - 18-Feb-2006
Author:
  Graeme Rocher

Field Summary

Fields inherited from interface org.codehaus.groovy.grails.commons.GrailsDomainClassProperty
`BELONGS_TO, CLASS, CONSTRAINTS, DATE_CREATED, EMBEDDED, EVANESCENT, FETCH_EAGER, FETCH_LAZY, FETCH_MODE, HAS_MANY, IDENTITY, LAST_UPDATED, MAPPED_BY, MAPPING, MAPPING_STRATEGY, META_CLASS, RELATES_TO_MANY, SORT, TRANSIENT, VERSION`

Constructor Summary
`GrailsHibernateDomainClassProperty(GrailsHibernateDomainClass domainClass, String propertyName)`

Method Summary
`String` `getColumnName()`
`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` `setAssociation(boolean association)`
`void` `setBidirectional(boolean bidirectional)`
`void` `setColumnName(String columnName)`
`void` `setIdentity(boolean identity)`
`void` `setManyToMany(boolean manyToMany)`
`void` `setManyToOne(boolean manyToOne)`
`void` `setOneToMany(boolean oneToMany)`
`void` `setOneToOne(boolean oneToOne)`
`void` `setOptional(boolean optional)`
`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
`void` `setRelatedClassType(Class relatedType)`
`void` `setType(Class type)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GrailsHibernateDomainClassProperty

    public GrailsHibernateDomainClassProperty(GrailsHibernateDomainClass domainClass,
                                              String propertyName)

Method Detail

### getName

    public String getName()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns the name of the property

  Specified by:
    `getName` in interface `GrailsDomainClassProperty`
  Returns:
    The property name

### getType

    public Class getType()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns the type for the domain class

  Specified by:
    `getType` in interface `GrailsDomainClassProperty`
  Returns:
    The property type

### setType

    public void setType(Class type)

### getTypePropertyName

    public String getTypePropertyName()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns the class type as a property name representation

  Specified by:
    `getTypePropertyName` in interface `GrailsDomainClassProperty`
  Returns:
    The property name representation

### getDomainClass

    public GrailsDomainClass getDomainClass()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns the parent domain class of the property instance

  Specified by:
    `getDomainClass` in interface `GrailsDomainClassProperty`
  Returns:
    The parent domain class

### isPersistent

    public boolean isPersistent()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns true if the domain class property is a persistent property

  Specified by:
    `isPersistent` in interface `GrailsDomainClassProperty`
  Returns:
    Whether the property is persistent

### getNaturalName

    public String getNaturalName()

  Specified by:
    `getNaturalName` in interface `GrailsDomainClassProperty`
  Returns:
    The natural name representation of the property (eg. 'lastName' becomes 'Last Name'

### setReferencedDomainClass

    public void setReferencedDomainClass(GrailsDomainClass referencedGrailsDomainClass)

  Description copied from interface: `GrailsDomainClassProperty`
  Sets the references domain class on the property

  Specified by:
    `setReferencedDomainClass` in interface `GrailsDomainClassProperty`

### setOtherSide

    public void setOtherSide(GrailsDomainClassProperty referencedProperty)

  Description copied from interface: `GrailsDomainClassProperty`
  Sets the other side of an associative property

  Specified by:
    `setOtherSide` in interface `GrailsDomainClassProperty`

### getOtherSide

    public GrailsDomainClassProperty getOtherSide()

  Description copied from interface: `GrailsDomainClassProperty`

  Returns the other side of a bidirectional association

  Specified by:
    `getOtherSide` in interface `GrailsDomainClassProperty`
  Returns:
    The other side of the relationship or null if not known

### getReferencedPropertyType

    public Class getReferencedPropertyType()

  Description copied from interface: `GrailsDomainClassProperty`

  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();

  Specified by:
    `getReferencedPropertyType` in interface `GrailsDomainClassProperty`
  Returns:
    The referenced type

### isIdentity

    public boolean isIdentity()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns true of the property is an identifier

  Specified by:
    `isIdentity` in interface `GrailsDomainClassProperty`
  Returns:
    Whether the property is the identifier

### setIdentity

    public void setIdentity(boolean identity)

### isOptional

    public boolean isOptional()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns true if the property is required

  Specified by:
    `isOptional` in interface `GrailsDomainClassProperty`
  Returns:
    Whether the property is optional

### setOptional

    public void setOptional(boolean optional)

### isOneToOne

    public boolean isOneToOne()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns true if the property is a one-to-one relationship

  Specified by:
    `isOneToOne` in interface `GrailsDomainClassProperty`
  Returns:
    True if it is a one-to-one relationship

### setOneToOne

    public void setOneToOne(boolean oneToOne)

### isManyToOne

    public boolean isManyToOne()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns true if the property is a many-to-one relationship

  Specified by:
    `isManyToOne` in interface `GrailsDomainClassProperty`
  Returns:
    Whether it is a manyToOne

### setManyToOne

    public void setManyToOne(boolean manyToOne)

### isAssociation

    public boolean isAssociation()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns true if this property is a relationship property

  Specified by:
    `isAssociation` in interface `GrailsDomainClassProperty`
  Returns:
    True if it is an associative property

### isEnum

    public boolean isEnum()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns true if this properties type is an enum

  Specified by:
    `isEnum` in interface `GrailsDomainClassProperty`
  Returns:
    True if it is

### setAssociation

    public void setAssociation(boolean association)

### isOneToMany

    public boolean isOneToMany()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns true if the property is a one-to-many relationship

  Specified by:
    `isOneToMany` in interface `GrailsDomainClassProperty`
  Returns:
    Whether it is a oneToMany

### setOneToMany

    public void setOneToMany(boolean oneToMany)

### isManyToMany

    public boolean isManyToMany()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns true if the property is a many-to-many relationship

  Specified by:
    `isManyToMany` in interface `GrailsDomainClassProperty`
  Returns:
    True if it is a manyToMany

### setManyToMany

    public void setManyToMany(boolean manyToMany)

### isBidirectional

    public boolean isBidirectional()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns true if the property is a bi-directional relationship

  Specified by:
    `isBidirectional` in interface `GrailsDomainClassProperty`
  Returns:
    A boolean value

### getFieldName

    public String getFieldName()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns the domain field name for this property

  Specified by:
    `getFieldName` in interface `GrailsDomainClassProperty`

### setBidirectional

    public void setBidirectional(boolean bidirectional)

### getReferencedDomainClass

    public GrailsDomainClass getReferencedDomainClass()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns the GrailsDomainClass of a relationship property or null if the property is not a relationship property

  Specified by:
    `getReferencedDomainClass` in interface `GrailsDomainClassProperty`
  Returns:
    The GrailsDomainClass

### setRelatedClassType

    public void setRelatedClassType(Class relatedType)

### isInherited

    public boolean isInherited()

  Description copied from interface: `GrailsDomainClassProperty`
  Whether the property is inherited from a super class

  Specified by:
    `isInherited` in interface `GrailsDomainClassProperty`
  Returns:
    True if its inherited

### getFetchMode

    public int getFetchMode()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns the configured fetch mode for the property

  Specified by:
    `getFetchMode` in interface `GrailsDomainClassProperty`

### isOwningSide

    public boolean isOwningSide()

  Description copied from interface: `GrailsDomainClassProperty`
  Whether this side of the association is the "owning" side

  Specified by:
    `isOwningSide` in interface `GrailsDomainClassProperty`
  Returns:
    True if it is the owning side

### isCircular

    public boolean isCircular()

  Description copied from interface: `GrailsDomainClassProperty`
  Whether the relationship is cirucular

  Specified by:
    `isCircular` in interface `GrailsDomainClassProperty`
  Returns:
    True if it is

### getReferencedPropertyName

    public String getReferencedPropertyName()

  Description copied from interface: `GrailsDomainClassProperty`
  Retrieves the name of property referenced by this property if it is an association and is known, otherwise null

  Specified by:
    `getReferencedPropertyName` in interface `GrailsDomainClassProperty`
  Returns:
    The name of the prop

### isEmbedded

    public boolean isEmbedded()

  Description copied from interface: `GrailsDomainClassProperty`
  Returns true if this propert is an embedded component

  Specified by:
    `isEmbedded` in interface `GrailsDomainClassProperty`
  Returns:
    True if it is, false otherwise

### getComponent

    public GrailsDomainClass getComponent()

  Description copied from interface: `GrailsDomainClassProperty`
  If #isEmbedded returns true then this method can be called to obtain a reference to the embedded component, which implements the GrailsDomainClass interface

  Specified by:
    `getComponent` in interface `GrailsDomainClassProperty`
  Returns:
    The component or null if it is not an embedded component
  See Also:
    `GrailsDomainClass`, `GrailsDomainClassProperty.isEmbedded()`

### setOwningSide

    public void setOwningSide(boolean b)

  Specified by:
    `setOwningSide` in interface `GrailsDomainClassProperty`

### isBasicCollectionType

    public boolean isBasicCollectionType()

  Description copied from interface: `GrailsDomainClassProperty`
  Return whether this is a collection of basic types like String, Integer etc.

  Specified by:
    `isBasicCollectionType` in interface `GrailsDomainClassProperty`
  Returns:
    True if it is a collection of basic types

### setColumnName

    public void setColumnName(String columnName)

### getColumnName

    public String getColumnName()

Copyright (c) 2005-2009 The Grails project