org.codehaus.groovy.grails.commons
Interface GrailsClass

All Known Subinterfaces:
ExternalGrailsDomainClass, GrailsBootstrapClass, GrailsCodecClass, GrailsControllerClass, GrailsDataSource, GrailsDomainClass, GrailsFiltersClass, GrailsServiceClass, GrailsTagLibClass, GrailsUrlMappingsClass, InjectableGrailsClass
All Known Implementing Classes:
AbstractGrailsClass, AbstractGrailsPlugin.GrailsPluginClass, AbstractInjectableGrailsClass, DefaultGrailsBootstrapClass, DefaultGrailsClass, DefaultGrailsCodecClass, DefaultGrailsControllerClass, DefaultGrailsDomainClass, DefaultGrailsServiceClass, DefaultGrailsTagLibClass, DefaultGrailsUrlMappingsClass, GrailsHibernateDomainClass

public interface GrailsClass

This interface represents any class in a Grails application.

Since:
0.1 Created: Jul 2, 2005
Author:
Steven Devijver, Graeme Rocher

Method Summary
 Class getClazz()
           Returns the actual clazz represented by the GrailsClass
 String getFullName()
          Returns the full name of the class in the application with the the trailing convention part and with the package name.
 String getLogicalPropertyName()
          Returns the logical name of the class as a property name
 groovy.lang.MetaClass getMetaClass()
           
 String getName()
          Returns the logical name of the class in the application without the trailing convention part if applicable and without the package name.
 String getNaturalName()
          Returns the name of the property in natural terms (eg.
 String getPackageName()
          Returns the package name of the class.
 String getPropertyName()
          Returns the name of the class as a property name
 Object getPropertyValue(String name)
          Gets the initial value of the given property on the class
 Object getPropertyValue(String name, Class type)
          Obtains a property value for the given name and type
 BeanWrapper getReference()
           
 String getShortName()
          Returns the short name of the class without package prefix
 boolean hasProperty(String name)
          Returns true if the class has the specified property
 Object newInstance()
          Creates a new instance of this class.
 

Method Detail

getPropertyValue

Object getPropertyValue(String name)

Gets the initial value of the given property on the class

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

hasProperty

boolean hasProperty(String name)

Returns true if the class has the specified property

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

newInstance

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

getName

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

getShortName

String getShortName()

Returns the short name of the class without package prefix

Returns:
The short name

getFullName

String getFullName()

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

Returns:
the full name

getPropertyName

String getPropertyName()

Returns the name of the class as a property name

Returns:
The property name representation

getLogicalPropertyName

String getLogicalPropertyName()

Returns the logical name of the class as a property name

Returns:
The logical property name

getNaturalName

String getNaturalName()

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

Returns:
The natural property name


getPackageName

String getPackageName()

Returns the package name of the class.

Returns:
the package name

getClazz

Class getClazz()

Returns the actual clazz represented by the GrailsClass

Returns:
the class

getMetaClass

groovy.lang.MetaClass getMetaClass()
Returns:
The MetaClass for this Grails class

getReference

BeanWrapper getReference()

getPropertyValue

Object getPropertyValue(String name,
                        Class type)
Obtains a property value for the given name and type

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


Copyright (c) 2005-2006 The Grails project