Package grails.core
Interface GrailsClass
-
- All Superinterfaces:
org.springframework.beans.factory.Aware,GrailsApplicationAware
- All Known Subinterfaces:
GrailsControllerClass,GrailsDataSource,GrailsDomainClass,GrailsServiceClass,GrailsUrlMappingsClass,InjectableGrailsClass
- All Known Implementing Classes:
AbstractGrailsClass,AbstractInjectableGrailsClass,DefaultGrailsClass,DefaultGrailsControllerClass,DefaultGrailsDomainClass,DefaultGrailsServiceClass,DefaultGrailsUrlMappingsClass
public interface GrailsClass extends GrailsApplicationAware
Represents any class in a Grails application.- Since:
- 0.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description GrailsApplicationgetApplication()The GrailsApplication that this class belongs tojava.lang.ClassgetClazz()Returns the actual clazz represented by the GrailsClass.java.lang.StringgetFullName()Returns the full name of the class in the application with the trailing convention part and with the package name.java.lang.StringgetLogicalPropertyName()Returns the logical name of the class as a property name.groovy.lang.MetaClassgetMetaClass()java.lang.StringgetName()Returns the logical name of the class in the application without the trailing convention part if applicable and without the package name.java.lang.StringgetNaturalName()Returns the name of the property in natural terms (eg.java.lang.StringgetPackageName()Returns the package name of the class.java.lang.StringgetPluginName()java.lang.StringgetPropertyName()Returns the name of the class as a property name.java.lang.ObjectgetPropertyValue(java.lang.String name)Gets the initial value of the given property on the class.<T> TgetPropertyValue(java.lang.String name, java.lang.Class<T> type)Obtains a property value for the given name and typejava.lang.ObjectgetReferenceInstance()java.lang.StringgetShortName()Returns the short name of the class without package prefix.booleanhasProperty(java.lang.String name)Returns true if the class has the specified property.booleanisAbstract()Whether the class is abstract or notjava.lang.ObjectnewInstance()Creates a new instance of this class.-
Methods inherited from interface grails.core.support.GrailsApplicationAware
setGrailsApplication
-
-
-
-
Method Detail
-
isAbstract
boolean isAbstract()
Whether the class is abstract or not- Returns:
- true if it is abstract
-
getApplication
GrailsApplication getApplication()
The GrailsApplication that this class belongs to- Returns:
- The GrailsApplication instance
-
getPropertyValue
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
-
hasProperty
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
-
newInstance
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
-
getName
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
-
getShortName
java.lang.String getShortName()
Returns the short name of the class without package prefix.- Returns:
- The short name
-
getFullName
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
-
getPropertyName
java.lang.String getPropertyName()
Returns the name of the class as a property name.- Returns:
- The property name representation
-
getLogicalPropertyName
java.lang.String getLogicalPropertyName()
Returns the logical name of the class as a property name.- Returns:
- The logical property name
-
getNaturalName
java.lang.String getNaturalName()
Returns the name of the property in natural terms (eg. 'lastName' becomes 'Last Name')- Returns:
- The natural property name.
-
getPackageName
java.lang.String getPackageName()
Returns the package name of the class.- Returns:
- The package name
-
getClazz
java.lang.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
-
getReferenceInstance
java.lang.Object getReferenceInstance()
- Returns:
- Sample (reference) instance for this Grails class
-
getPropertyValue
<T> T getPropertyValue(java.lang.String name, java.lang.Class<T> type)Obtains a property value for the given name and type- Parameters:
name- The nametype- The type- Returns:
- The property value
-
getPluginName
java.lang.String getPluginName()
- Returns:
- The plugin where the artefact originates from
-
-