Groovy Documentation

org.codehaus.groovy.grails.commons
[Java] Class AbstractGrailsClass

java.lang.Object
  org.codehaus.groovy.grails.commons.AbstractGrailsClass
All Implemented Interfaces:
GrailsClass

public abstract class AbstractGrailsClass
extends java.lang.Object

Abstract base class for Grails types that provides common functionality for evaluating conventions within classes.

Authors:
Steven Devijver
Graeme Rocher
Since:
0.1


Field Summary
protected GrailsApplication grailsApplication

 
Constructor Summary
AbstractGrailsClass(java.lang.Class clazz, java.lang.String trailingName)

Used by all child classes to create a new instance and get the name right.

 
Method Summary
java.lang.Class getClazz()

java.lang.String getFullName()

GrailsApplication getGrailsApplication()

java.lang.String getLogicalPropertyName()

groovy.lang.MetaClass getMetaClass()

@return the metaClass

java.lang.String getName()

java.lang.String getNaturalName()

java.lang.String getPackageName()

java.beans.PropertyDescriptor[] getPropertyDescriptors()

java.lang.String getPropertyName()

protected java.lang.Object getPropertyOrStaticPropertyOrFieldValue(java.lang.String name, java.lang.Class type)

java.lang.Class getPropertyType(java.lang.String typeName)

java.lang.Object getPropertyValue(java.lang.String propName, java.lang.Class type)

Get the value of the named property, with support for static properties in both Java and Groovy classes (which as of Groovy JSR 1.0 RC 01 only have getters in the metaClass)

java.lang.Object getPropertyValue(java.lang.String propName)

java.lang.Object getPropertyValueObject(java.lang.String propertyNAme)

org.springframework.beans.BeanWrapper getReference()

Used to get configured property values.

java.lang.Object getReferenceInstance()

java.lang.String getShortName()

java.lang.Object getStaticPropertyValue(java.lang.String propName, java.lang.Class type)

Get the value of the named static property.

boolean hasMetaMethod(java.lang.String methodName)

boolean hasMetaMethod(java.lang.String methodName, java.lang.Object[] args)

boolean hasMetaProperty(java.lang.String propName)

boolean hasProperty(java.lang.String propName)

boolean isAbstract()

boolean isActionMethod(java.lang.String methodName)

boolean isReadableProperty(java.lang.String propName)

java.lang.Object newInstance()

void setGrailsApplication(GrailsApplication grailsApplication)

java.lang.String toString()

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

grailsApplication

protected GrailsApplication grailsApplication


 
Constructor Detail

AbstractGrailsClass

public AbstractGrailsClass(java.lang.Class clazz, java.lang.String trailingName)
Used by all child classes to create a new instance and get the name right.
Parameters:
clazz - the Grails class
trailingName - the trailing part of the name for this class type


 
Method Detail

getClazz

public java.lang.Class getClazz()


getFullName

public java.lang.String getFullName()


getGrailsApplication

public GrailsApplication getGrailsApplication()


getLogicalPropertyName

public java.lang.String getLogicalPropertyName()


getMetaClass

public groovy.lang.MetaClass getMetaClass()
Returns:
the metaClass


getName

public java.lang.String getName()


getNaturalName

public java.lang.String getNaturalName()


getPackageName

public java.lang.String getPackageName()


getPropertyDescriptors

public java.beans.PropertyDescriptor[] getPropertyDescriptors()


getPropertyName

public java.lang.String getPropertyName()


getPropertyOrStaticPropertyOrFieldValue

protected java.lang.Object getPropertyOrStaticPropertyOrFieldValue(@SuppressWarnings("hiding") java.lang.String name, java.lang.Class type)

Looks for a property of the reference instance with a given name and type.

If found its value is returned. We follow the Java bean conventions with augmentation for groovy support and static fields/properties. We will therefore match, in this order:

  1. Public static field
  2. Public static property with getter method
  3. Standard public bean property (with getter or just public field, using normal introspection)
Returns:
property value or null if no property or static field was found


getPropertyType

public java.lang.Class getPropertyType(java.lang.String typeName)


getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String propName, java.lang.Class type)
Get the value of the named property, with support for static properties in both Java and Groovy classes (which as of Groovy JSR 1.0 RC 01 only have getters in the metaClass)
Parameters:
propName
type
Returns:
The property value or null


getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String propName)


getPropertyValueObject

public java.lang.Object getPropertyValueObject(java.lang.String propertyNAme)


getReference

@Deprecated
public org.springframework.beans.BeanWrapper getReference()
Used to get configured property values.
deprecated:
Returns:
BeanWrapper instance that holds reference


getReferenceInstance

public java.lang.Object getReferenceInstance()


getShortName

public java.lang.String getShortName()


getStaticPropertyValue

public java.lang.Object getStaticPropertyValue(java.lang.String propName, java.lang.Class type)
Get the value of the named static property.
Parameters:
propName
type
Returns:
The property value or null


hasMetaMethod

public boolean hasMetaMethod(java.lang.String methodName)


hasMetaMethod

public boolean hasMetaMethod(java.lang.String methodName, java.lang.Object[] args)


hasMetaProperty

public boolean hasMetaProperty(java.lang.String propName)


hasProperty

public boolean hasProperty(java.lang.String propName)


isAbstract

public boolean isAbstract()


isActionMethod

public boolean isActionMethod(java.lang.String methodName)


isReadableProperty

public boolean isReadableProperty(java.lang.String propName)


newInstance

public java.lang.Object newInstance()


setGrailsApplication

public void setGrailsApplication(GrailsApplication grailsApplication)


toString

@Override
public java.lang.String toString()


 

Groovy Documentation