public abstract class AbstractGrailsClass extends java.lang.Object implements GrailsClass
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.
|
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.
|
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) |
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
org.springframework.context.ApplicationContext that
loads the Grails application. |
java.lang.String |
toString() |
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)
GrailsApplicationAware
This method is called by the org.springframework.context.ApplicationContext
that
loads the Grails application. The GrailsApplication
instance that represents
the loaded Grails application is injected.
setGrailsApplication
in interface GrailsApplicationAware
grailsApplication
- the GrailsApplication
object that represents this Grails applicationpublic GrailsApplication getGrailsApplication()
GrailsClass
getGrailsApplication
in interface GrailsClass
public java.lang.String getShortName()
GrailsClass
getShortName
in interface GrailsClass
public java.lang.Class<?> getClazz()
GrailsClass
getClazz
in interface GrailsClass
public java.lang.Object newInstance()
GrailsClass
newInstance
in interface GrailsClass
public java.lang.String getName()
GrailsClass
getName
in interface GrailsClass
public java.lang.String getNaturalName()
GrailsClass
getNaturalName
in interface GrailsClass
public java.lang.String getFullName()
GrailsClass
getFullName
in interface GrailsClass
public java.lang.String getPropertyName()
GrailsClass
getPropertyName
in interface GrailsClass
public java.lang.String getLogicalPropertyName()
GrailsClass
getLogicalPropertyName
in interface GrailsClass
public java.lang.String getPackageName()
GrailsClass
getPackageName
in interface GrailsClass
public java.lang.Object getReferenceInstance()
getReferenceInstance
in interface GrailsClass
public 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 BeanWrapper getReference()
getReference
in interface GrailsClass
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 GrailsClass
propName
- type
- public java.lang.Object getPropertyValueObject(java.lang.String propertyNAme)
public java.lang.Object getPropertyValue(java.lang.String propName)
GrailsClass
getPropertyValue
in interface GrailsClass
propName
- The name of the propertypublic boolean isAbstract()
GrailsClass
isAbstract
in interface GrailsClass
public boolean hasProperty(java.lang.String propName)
GrailsClass
hasProperty
in interface GrailsClass
propName
- The name of the propertypublic MetaClass getMetaClass()
getMetaClass
in interface GrailsClass
public java.lang.String toString()
toString
in class java.lang.Object