Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

All Superinterfaces:
  GrailsClass

All Known Subinterfaces:
  ExternalGrailsDomainClass

All Known Implementing Classes:
  DefaultGrailsDomainClass, GrailsHibernateDomainClass

    public interface GrailsDomainClass

extends GrailsClass

Represents a persistable Grails domain class

Since:
  Jul 5, 2005
Author:
  Graeme Rocher

Field Summary
`static String` | `GORM` The name of the default ORM implementation used to map the class
`static String` | `ORM_MAPPING`

Method Summary
`Map` | `getAssociationMap()` Returns this classes association map
`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
`String` | `getFieldName(String propertyName)` Returns the field name for the given property name
`GrailsDomainClassProperty` | `getIdentifier()` Returns the identifier property
`Map` | `getMappedBy()`
`String` | `getMappingStrategy()`
`GrailsDomainClassProperty[]` | `getPersistantProperties()` Deprecated. Use #getPersistentProperties instead
`GrailsDomainClassProperty[]` | `getPersistentProperties()` Returns all of the persistant properties of the domain class
`GrailsDomainClassProperty[]` | `getProperties()` Returns all of the properties of the domain class
`GrailsDomainClassProperty` | `getPropertyByName(String name)` Returns the property for the given name
`String` | `getPropertyName()` Returns the default property name of the GrailsClass.
`Class` | `getRelatedClassType(String propertyName)` Returns the type of the related class of the given property
`Set<GrailsDomainClass>` | `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(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(String propertyName)` Returns true if the given property is a bi-directional relationship
`boolean` | `isManyToOne(String propertyName)` Returns true if the given property is a many to one relationship
`boolean` | `isOneToMany(String propertyName)` Returns true if the given property is a one to many relationship
`boolean` | `isOwningClass(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(String strategy)` Sets the strategy to use for ORM mapping.
`void` | `setValidator(Validator validator)` Sets the validator for this domain class

Methods inherited from interface org.codehaus.groovy.grails.commons.GrailsClass
`getClazz, getFullName, getLogicalPropertyName, getMetaClass, getName, getNaturalName, getPackageName, getPropertyValue, getPropertyValue, getReference, getReferenceInstance, getShortName, hasProperty, newInstance`

Field Detail

### GORM

    static final String GORM

  The name of the default ORM implementation used to map the class

  See Also:
    Constant Field Values

### ORM_MAPPING

    static final String ORM_MAPPING

See Also:
  Constant Field Values

Method Detail

### isOwningClass

    boolean isOwningClass(Class domainClass)

  Parameters:
    `domainClass` -
  Returns:
    True if the specifying domain class is on the owning side of a relationship

### getProperties

    GrailsDomainClassProperty[] getProperties()

  Returns all of the properties of the domain class

  Returns:
    The domain class properties

### getPersistantProperties

    GrailsDomainClassProperty[] getPersistantProperties()

  Deprecated. Use #getPersistentProperties instead

  Returns all of the persistant properties of the domain class

  Returns:
    The domain class' persistant properties

### getPersistentProperties

    GrailsDomainClassProperty[] getPersistentProperties()

  Returns all of the persistant properties of the domain class

  Returns:
    The domain class' persistant properties

### getIdentifier

    GrailsDomainClassProperty getIdentifier()

  Returns the identifier property

  Returns:
    The identifier property

### getVersion

    GrailsDomainClassProperty getVersion()

  Returns the version property

  Returns:
    The version property

### getAssociationMap

    Map getAssociationMap()

  Returns this classes association map

  Returns:
    The association map

### getPropertyByName

    GrailsDomainClassProperty getPropertyByName(String name)

  Returns the property for the given name

  Parameters:
    `name` - The property for the name
  Returns:
    The domain class property for the given name
  Throws:
    `InvalidPropertyException`

### getFieldName

    String getFieldName(String propertyName)

  Returns the field name for the given property name

  Parameters:
    `propertyName` -
  Returns:
    The field representation of the property name

### getPropertyName

    String getPropertyName()

  Returns the default property name of the GrailsClass. For example the property name for a class called "User" would be "user"

  Specified by:
    `getPropertyName` in interface `GrailsClass`
  Returns:
    The property name representation of the class name

### isOneToMany

    boolean isOneToMany(String propertyName)

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

  Parameters:
    `propertyName` - The name of the property
  Returns:
    A boolean value

### isManyToOne

    boolean isManyToOne(String propertyName)

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

  Parameters:
    `propertyName` - The name of the property
  Returns:
    A boolean value

### isBidirectional

    boolean isBidirectional(String propertyName)

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

  Parameters:
    `propertyName` - The name of the property
  Returns:
    A boolean value

### getRelatedClassType

    Class getRelatedClassType(String propertyName)

  Returns the type of the related class of the given property

  Parameters:
    `propertyName` - The name of the property
  Returns:
    The type of the class or null if no relationship exists for the specified property

### getConstrainedProperties

    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

  Returns:
    A map of constraints

### getValidator

    Validator getValidator()

  Retreives the validator for this domain class

  Returns:
    A validator instance or null if none exists

### setValidator

    void setValidator(Validator validator)

  Sets the validator for this domain class

  Parameters:
    `validator` - The domain class validator to set

### getMappingStrategy

    String getMappingStrategy()

  Returns:
    The name of the ORM implementation used to map the domain class (default is "GORM")

### isRoot

    boolean isRoot()

  Whether the class is the root of a heirarchy

  Returns:
    True if it is the root of the heirarchy

### getSubClasses

    Set<GrailsDomainClass> getSubClasses()

  Returns the sub-classes for this class if any

  Returns:
    A set of sub classes or an empty set if none exist

### refreshConstraints

    void refreshConstraints()

  Refreshes the constraint defined on a domain class

### hasSubClasses

    boolean hasSubClasses()

  Returns true if the domain classes has sub classes

  Returns:
    True if it does

### getMappedBy

    Map getMappedBy()

  Returns:
    The map that defines association mappings

### hasPersistentProperty

    boolean hasPersistentProperty(String propertyName)

  Returns true if this domain class has a persistent property for the given name

  Parameters:
    `propertyName` - The property name
  Returns:
    True if it does

### setMappingStrategy

    void setMappingStrategy(String strategy)

  Sets the strategy to use for ORM mapping. Default is GORM

  Parameters:
    `strategy` - The mapping strategy

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2005-2009 The Grails project