GrailsDomainClass (Grails 3.3.3)
Date: 2018-03-07

Package: grails.core

## [Java] Interface GrailsDomainClass

- grails.core.support.GrailsApplicationAware

- All Superinterfaces:
    GrailsClass, GrailsApplicationAware

  Represents a persistable Grails domain class.

  deprecated:
    Use org.grails.datastore.mapping.model.PersistentEntity instead
  Authors:
    Graeme Rocher
  Since:
    Jul 5, 2005

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `java.lang.String` | `GORM` | The name of the default ORM implementation used to map the class
    `java.lang.String` | `ORM_MAPPING` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `java.util.Map` | `getAssociationMap()` Returns this classes association map
    `` | `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()` @return The map that defines association mappings
    `` | `java.lang.String` | `getMappingStrategy()` @return The name of the ORM implementation used to map the domain class (default is "GORM")
    `` | `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()`
    `` | `java.lang.Class` | `getRelatedClassType(java.lang.String propertyName)` Returns the type of the related class of the given property
    `` | `java.util.Set<GrailsDomainClass>` | `getSubClasses()` Returns the sub-classes for this class if any
    `` | `org.springframework.validation.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` | `isAutowire()` @return Whether to autowire
    `` | `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)` @param domainClass
    `` | `boolean` | `isRoot()` Whether the class is the root of a hierarchy
    `` | `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(org.springframework.validation.Validator validator)` Sets the validator for this domain class

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `interface GrailsClass` | `getApplication, getClazz, getFullName, getLogicalPropertyName, getMetaClass, getName, getNaturalName, getPackageName, getPluginName, getPropertyName, getPropertyValue, getPropertyValue, getReferenceInstance, getShortName, hasProperty, isAbstract, newInstance`
    `interface GrailsApplicationAware` | `setGrailsApplication`

- - ### Field Detail

    - #### public java.lang.String GORM

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

    - #### public java.lang.String ORM_MAPPING

  - ### Method Detail

    - #### @java.lang.Deprecated @java.lang.SuppressWarnings("rawtypes") public java.util.Map getAssociationMap()

      Returns this classes association map

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Returns:
        The association map

    - #### @java.lang.SuppressWarnings("rawtypes") public 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

      Returns:
        A map of constraints

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

      Returns the field name for the given property name

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

    - #### @java.lang.Deprecated public GrailsDomainClassProperty getIdentifier()

      Returns the identifier property

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Returns:
        The identifier property

    - #### @java.lang.Deprecated @java.lang.SuppressWarnings("rawtypes") public java.util.Map getMappedBy()

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Returns:
        The map that defines association mappings

    - #### @java.lang.Deprecated public java.lang.String getMappingStrategy()

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Returns:
        The name of the ORM implementation used to map the domain class (default is "GORM")

    - #### @java.lang.Deprecated public GrailsDomainClassProperty[] getPersistentProperties()

      Returns all of the persistant properties of the domain class

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Returns:
        The domain class' persistant properties

    - #### @java.lang.Deprecated public GrailsDomainClassProperty getPersistentProperty(java.lang.String name)

      Returns the property for the given name or null if non exists

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Parameters:
        `name` - The property name
      Returns:
        The property or null

    - #### @java.lang.Deprecated public GrailsDomainClassProperty[] getProperties()

      Returns all of the properties of the domain class

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Returns:
        The domain class properties

    - #### @java.lang.Deprecated public GrailsDomainClassProperty getPropertyByName(java.lang.String name)

      Returns the property for the given name

      throws:
        org.grails.core.exceptions.InvalidPropertyException
      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Parameters:
        `name` - The property for the name
      Returns:
        The domain class property for the given name

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

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

      Returns:
        The property name representation of the class name

    - #### @java.lang.Deprecated @java.lang.SuppressWarnings("rawtypes") public java.lang.Class getRelatedClassType(java.lang.String propertyName)

      Returns the type of the related class of the given property

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Parameters:
        `propertyName` - The name of the property
      Returns:
        The type of the class or null if no relationship exists for the specified property

    - #### @java.lang.Deprecated public java.util.Set<GrailsDomainClass> getSubClasses()

      Returns the sub-classes for this class if any

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Returns:
        A set of sub classes or an empty set if none exist

    - #### public org.springframework.validation.Validator getValidator()

      Retreives the validator for this domain class

      Returns:
        A validator instance or null if none exists

    - #### @java.lang.Deprecated public GrailsDomainClassProperty getVersion()

      Returns the version property

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Returns:
        The version property

    - #### @java.lang.Deprecated public boolean hasPersistentProperty(java.lang.String propertyName)

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

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Parameters:
        `propertyName` - The property name
      Returns:
        true if it does

    - #### @java.lang.Deprecated public boolean hasSubClasses()

      Returns true if the domain classes has sub classes

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Returns:
        true if it does

    - #### public boolean isAutowire()

      Returns:
        Whether to autowire

    - #### @java.lang.Deprecated public boolean isBidirectional(java.lang.String propertyName)

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

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Parameters:
        `propertyName` - The name of the property
      Returns:
        A boolean value

    - #### @java.lang.Deprecated public boolean isManyToOne(java.lang.String propertyName)

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

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Parameters:
        `propertyName` - The name of the property
      Returns:
        A boolean value

    - #### @java.lang.Deprecated public boolean isOneToMany(java.lang.String propertyName)

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

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Parameters:
        `propertyName` - The name of the property
      Returns:
        A boolean value

    - #### @java.lang.SuppressWarnings("rawtypes") public boolean isOwningClass(java.lang.Class domainClass)

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

    - #### @java.lang.Deprecated public boolean isRoot()

      Whether the class is the root of a hierarchy

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Returns:
        true if it is the root of the hierarchy

    - #### @java.lang.Deprecated public void refreshConstraints()

      Refreshes the constraint defined on a domain class

    - #### @java.lang.Deprecated public void setMappingStrategy(java.lang.String strategy)

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

      deprecated:
        Use org.grails.datastore.mapping.model.MappingContext API instead
      Parameters:
        `strategy` - The mapping strategy

    - #### public void setValidator(org.springframework.validation.Validator validator)

      Sets the validator for this domain class

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