GrailsClass (Grails 6.0.0)

Package: grails.core

## [Java] Interface GrailsClass

- grails.core.support.GrailsApplicationAware

- All Superinterfaces:
    GrailsApplicationAware

      public interface GrailsClass
      extends GrailsApplicationAware

  Represents any class in a Grails application.

  Authors:
    Steven Devijver
    Graeme Rocher
  Since:
    0.1

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public GrailsApplication` | `getApplication()` The GrailsApplication that this class belongs to
    `` | `public java.lang.Class` | `getClazz()` Returns the actual clazz represented by the GrailsClass.
    `` | `public java.lang.String` | `getFullName()` Returns the full name of the class in the application with the trailing convention part and with the package name.
    `` | `public java.lang.String` | `getLogicalPropertyName()` Returns the logical name of the class as a property name.
    `` | `public groovy.lang.MetaClass` | `getMetaClass()` Returns: The MetaClass for this Grails class
    `` | `public java.lang.String` | `getName()` Returns the logical name of the class in the application without the trailing convention part if applicable and without the package name.
    `` | `public java.lang.String` | `getNaturalName()` Returns the name of the property in natural terms (eg.
    `` | `public java.lang.String` | `getPackageName()` Returns the package name of the class.
    `` | `public java.lang.String` | `getPluginName()` Returns: The plugin where the artefact originates from
    `` | `public java.lang.String` | `getPropertyName()` Returns the name of the class as a property name.
    `` | `public java.lang.Object` | `getPropertyValue(java.lang.String name)` Gets the initial value of the given property on the class.
    `<T>` | `public T` | `getPropertyValue(java.lang.String name, java.lang.Class<T> type)` Obtains a property value for the given name and type
    `` | `public java.lang.Object` | `getReferenceInstance()` Returns: Sample (reference) instance for this Grails class
    `` | `public java.lang.String` | `getShortName()` Returns the short name of the class without package prefix.
    `` | `public boolean` | `hasProperty(java.lang.String name)` Returns true if the class has the specified property.
    `` | `public boolean` | `isAbstract()` Whether the class is abstract or not
    `` | `public java.lang.Object` | `newInstance()` Creates a new instance of this class.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `interface GrailsApplicationAware` | `setGrailsApplication`

- - ### Method Detail

    - #### public GrailsApplication getApplication()

      The GrailsApplication that this class belongs to

      Returns:
        The GrailsApplication instance

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

      Returns the actual clazz represented by the GrailsClass.

      Returns:
        The class

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

      Returns the full name of the class in the application with the trailing convention part and with the package name.

      Returns:
        The full name

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

      Returns the logical name of the class as a property name.

      Returns:
        The logical property name

    - #### public groovy.lang.MetaClass getMetaClass()

      Returns:
        The MetaClass for this Grails class

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

      Returns the logical name of the class in the application without the trailing convention part if applicable and without the package name.

      Returns:
        The logical name

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

      Returns the name of the property in natural terms (eg. 'lastName' becomes 'Last Name')

      Returns:
        The natural property name.

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

      Returns the package name of the class.

      Returns:
        The package name

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

      Returns:
        The plugin where the artefact originates from

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

      Returns the name of the class as a property name.

      Returns:
        The property name representation

    - #### public java.lang.Object getPropertyValue(java.lang.String name)

      Gets the initial value of the given property on the class.

      Parameters:
        `name` - The name of the property
      Returns:
        The initial value

    - #### <T> public T getPropertyValue(java.lang.String name, java.lang.Class<T> type)

      Obtains a property value for the given name and type

      Parameters:
        `name` - The name
        `type` - The type
      Returns:
        The property value

    - #### public java.lang.Object getReferenceInstance()

      Returns:
        Sample (reference) instance for this Grails class

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

      Returns the short name of the class without package prefix.

      Returns:
        The short name

    - #### public boolean hasProperty(java.lang.String name)

      Returns true if the class has the specified property.

      Parameters:
        `name` - The name of the property
      Returns:
        true if it does

    - #### public boolean isAbstract()

      Whether the class is abstract or not

      Returns:
        true if it is abstract

    - #### public java.lang.Object newInstance()

      Creates a new instance of this class. This method can be used as factory method in the Spring application context.

      Returns:
        A new instance of this class