public abstract class AbstractGrailsClass extends java.lang.Object implements GrailsClass
| Modifier and Type | Field and Description |
|---|---|
protected GrailsApplication |
grailsApplication |
| Constructor and Description |
|---|
AbstractGrailsClass(java.lang.Class<?> clazz,
java.lang.String trailingName)
Used by all child classes to create a new instance and get the name right.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Class<?> |
getClazz()
Returns the actual clazz represented by the GrailsClass.
|
java.lang.String |
getFullName()
Returns the full name of the class in the application with the the trailing convention part and with
the package name.
|
GrailsApplication |
getGrailsApplication()
The GrailsApplication that this class belongs to
|
java.lang.String |
getLogicalPropertyName()
Returns the logical name of the class as a property name.
|
groovy.lang.MetaClass |
getMetaClass() |
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.
|
java.lang.String |
getNaturalName()
Returns the name of the property in natural terms (eg.
|
java.lang.String |
getPackageName()
Returns the package name of the class.
|
java.beans.PropertyDescriptor[] |
getPropertyDescriptors() |
java.lang.String |
getPropertyName()
Returns the name of the class as a property name.
|
protected <T> T |
getPropertyOrStaticPropertyOrFieldValue(java.lang.String name,
java.lang.Class<T> type)
Looks for a property of the reference instance with a given name and type.
|
java.lang.Class<?> |
getPropertyType(java.lang.String typeName) |
java.lang.Object |
getPropertyValue(java.lang.String propName)
Gets the initial value of the given property on the class.
|
<T> T |
getPropertyValue(java.lang.String propName,
java.lang.Class<T> 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 |
getPropertyValueObject(java.lang.String propertyNAme) |
org.springframework.beans.BeanWrapper |
getReference()
Deprecated.
|
java.lang.Object |
getReferenceInstance() |
java.lang.String |
getShortName()
Returns the short name of the class without package prefix.
|
<T> T |
getStaticPropertyValue(java.lang.String propName,
java.lang.Class<T> 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)
Returns true if the class has the specified property.
|
boolean |
isAbstract()
Whether the class is abstract or not
|
boolean |
isActionMethod(java.lang.String methodName) |
boolean |
isReadableProperty(java.lang.String propName) |
java.lang.Object |
newInstance()
Creates a new instance of this class.
|
void |
setGrailsApplication(GrailsApplication grailsApplication)
This method is called by the
ApplicationContext that
loads the Grails application. |
java.lang.String |
toString() |
protected GrailsApplication grailsApplication
public AbstractGrailsClass(java.lang.Class<?> clazz,
java.lang.String trailingName)
clazz - the Grails classtrailingName - the trailing part of the name for this class typepublic void setGrailsApplication(GrailsApplication grailsApplication)
GrailsApplicationAwareThis method is called by the ApplicationContext that
loads the Grails application. The GrailsApplication instance that represents
the loaded Grails application is injected.
setGrailsApplication in interface GrailsApplicationAwaregrailsApplication - the GrailsApplication object that represents this Grails applicationpublic GrailsApplication getGrailsApplication()
GrailsClassgetGrailsApplication in interface GrailsClasspublic java.lang.String getShortName()
GrailsClassgetShortName in interface GrailsClasspublic java.lang.Class<?> getClazz()
GrailsClassgetClazz in interface GrailsClasspublic java.lang.Object newInstance()
GrailsClassnewInstance in interface GrailsClasspublic java.lang.String getName()
GrailsClassgetName in interface GrailsClasspublic java.lang.String getNaturalName()
GrailsClassgetNaturalName in interface GrailsClasspublic java.lang.String getFullName()
GrailsClassgetFullName in interface GrailsClasspublic java.lang.String getPropertyName()
GrailsClassgetPropertyName in interface GrailsClasspublic java.lang.String getLogicalPropertyName()
GrailsClassgetLogicalPropertyName in interface GrailsClasspublic java.lang.String getPackageName()
GrailsClassgetPackageName in interface GrailsClasspublic java.lang.Object getReferenceInstance()
getReferenceInstance in interface GrailsClasspublic java.beans.PropertyDescriptor[] getPropertyDescriptors()
public java.lang.Class<?> getPropertyType(java.lang.String typeName)
public boolean isReadableProperty(java.lang.String propName)
public boolean isActionMethod(java.lang.String methodName)
public boolean hasMetaMethod(java.lang.String methodName)
public boolean hasMetaMethod(java.lang.String methodName,
java.lang.Object[] args)
public boolean hasMetaProperty(java.lang.String propName)
@Deprecated public org.springframework.beans.BeanWrapper getReference()
getReference in interface GrailsClassprotected <T> T getPropertyOrStaticPropertyOrFieldValue(java.lang.String name,
java.lang.Class<T> 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:
public <T> T getStaticPropertyValue(java.lang.String propName,
java.lang.Class<T> type)
propName - type - public <T> T getPropertyValue(java.lang.String propName,
java.lang.Class<T> type)
getPropertyValue in interface GrailsClasspropName - type - public java.lang.Object getPropertyValueObject(java.lang.String propertyNAme)
public java.lang.Object getPropertyValue(java.lang.String propName)
GrailsClassgetPropertyValue in interface GrailsClasspropName - The name of the propertypublic boolean isAbstract()
GrailsClassisAbstract in interface GrailsClasspublic boolean hasProperty(java.lang.String propName)
GrailsClasshasProperty in interface GrailsClasspropName - The name of the propertypublic groovy.lang.MetaClass getMetaClass()
getMetaClass in interface GrailsClasspublic java.lang.String toString()
toString in class java.lang.Object