Package org.grails.core
Class DefaultGrailsControllerClass
- java.lang.Object
-
- org.grails.core.AbstractGrailsClass
-
- org.grails.core.AbstractInjectableGrailsClass
-
- org.grails.core.DefaultGrailsControllerClass
-
- All Implemented Interfaces:
GrailsClass,GrailsControllerClass,InjectableGrailsClass,GrailsApplicationAware,org.springframework.beans.factory.Aware
public class DefaultGrailsControllerClass extends AbstractInjectableGrailsClass implements GrailsControllerClass
Evaluates the conventions contained within controllers to perform auto-configuration.- Since:
- 0.1
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.String>actionUriToViewNamestatic java.lang.StringALLOWED_HTTP_METHODS_PROPERTYstatic java.lang.StringCONTROLLERstatic java.lang.Object[]EMPTY_ARGSstatic java.lang.StringSCOPEstatic java.lang.StringSCOPE_SINGLETON-
Fields inherited from class org.grails.core.AbstractGrailsClass
grailsApplication
-
Fields inherited from interface grails.core.GrailsControllerClass
ACTION, AFTER_INTERCEPTOR, BEFORE_INTERCEPTOR, INDEX_ACTION, NAMESPACE_PROPERTY, VIEW
-
-
Constructor Summary
Constructors Constructor Description DefaultGrailsControllerClass(java.lang.Class<?> clazz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringactionUriToViewName(java.lang.String actionUri)java.util.Set<java.lang.String>getActions()java.lang.StringgetDefaultAction()Returns the default action for this Controller.java.lang.StringgetNamespace()java.lang.StringgetScope()voidinitialize()Initialize the controller classjava.lang.Objectinvoke(java.lang.Object controller, java.lang.String action)Invokes the controller action for the given name on the given controller instancebooleanisSingleton()booleanmapsToURI(java.lang.String uri)Tests if a controller maps to a given URI.voidregisterUrlConverter(UrlConverter urlConverter)Register a newUrlConverterwith the controllervoidsetGrailsApplication(GrailsApplication grailsApplication)This method is called by theApplicationContextthat loads the Grails application.-
Methods inherited from class org.grails.core.AbstractInjectableGrailsClass
byName, byType, getAvailable
-
Methods inherited from class org.grails.core.AbstractGrailsClass
getApplication, getClazz, getFullName, getLogicalPropertyName, getMetaClass, getMetaProperties, getName, getNaturalName, getPackageName, getPluginName, getPropertyDescriptors, getPropertyName, getPropertyOrStaticPropertyOrFieldValue, getPropertyType, getPropertyValue, getPropertyValue, getPropertyValueObject, getReferenceInstance, getShortName, getStaticPropertyValue, hasMetaMethod, hasMetaMethod, hasMetaProperty, hasProperty, isAbstract, isActionMethod, isReadableProperty, newInstance, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface grails.core.GrailsClass
getApplication, getClazz, getFullName, getLogicalPropertyName, getMetaClass, getName, getNaturalName, getPackageName, getPluginName, getPropertyName, getPropertyValue, getPropertyValue, getReferenceInstance, getShortName, hasProperty, isAbstract, newInstance
-
Methods inherited from interface grails.core.InjectableGrailsClass
byName, byType, getAvailable
-
-
-
-
Field Detail
-
CONTROLLER
public static final java.lang.String CONTROLLER
- See Also:
- Constant Field Values
-
ALLOWED_HTTP_METHODS_PROPERTY
public static final java.lang.String ALLOWED_HTTP_METHODS_PROPERTY
- See Also:
- Constant Field Values
-
EMPTY_ARGS
public static final java.lang.Object[] EMPTY_ARGS
-
SCOPE
public static final java.lang.String SCOPE
- See Also:
- Constant Field Values
-
SCOPE_SINGLETON
public static final java.lang.String SCOPE_SINGLETON
- See Also:
- Constant Field Values
-
actionUriToViewName
protected java.util.Map<java.lang.String,java.lang.String> actionUriToViewName
-
-
Method Detail
-
initialize
public void initialize()
Description copied from interface:GrailsControllerClassInitialize the controller class- Specified by:
initializein interfaceGrailsControllerClass
-
setGrailsApplication
public void setGrailsApplication(GrailsApplication grailsApplication)
Description copied from interface:GrailsApplicationAwareThis method is called by the
ApplicationContextthat loads the Grails application. TheGrailsApplicationinstance that represents the loaded Grails application is injected.- Specified by:
setGrailsApplicationin interfaceGrailsApplicationAware- Overrides:
setGrailsApplicationin classAbstractGrailsClass- Parameters:
grailsApplication- theGrailsApplicationobject that represents this Grails application
-
getActions
public java.util.Set<java.lang.String> getActions()
- Specified by:
getActionsin interfaceGrailsControllerClass- Returns:
- The action names
-
getNamespace
public java.lang.String getNamespace()
- Specified by:
getNamespacein interfaceGrailsControllerClass- Returns:
- the namespace of this controller, null if none was specified
-
getScope
public java.lang.String getScope()
- Specified by:
getScopein interfaceGrailsControllerClass- Returns:
- The scope of the controller, defaults to singleton
-
isSingleton
public boolean isSingleton()
- Specified by:
isSingletonin interfaceGrailsControllerClass- Returns:
- Whether the scope is singleton
-
getDefaultAction
public java.lang.String getDefaultAction()
Description copied from interface:GrailsControllerClassReturns the default action for this Controller.- Specified by:
getDefaultActionin interfaceGrailsControllerClass- Returns:
- The default action
-
mapsToURI
public boolean mapsToURI(java.lang.String uri)
Description copied from interface:GrailsControllerClassTests if a controller maps to a given URI.- Specified by:
mapsToURIin interfaceGrailsControllerClass- Returns:
- true if controller maps to URI
-
registerUrlConverter
public void registerUrlConverter(UrlConverter urlConverter)
Register a newUrlConverterwith the controller- Specified by:
registerUrlConverterin interfaceGrailsControllerClass- Parameters:
urlConverter- TheUrlConverterto register
-
invoke
public java.lang.Object invoke(java.lang.Object controller, java.lang.String action) throws java.lang.ThrowableInvokes the controller action for the given name on the given controller instance- Specified by:
invokein interfaceGrailsControllerClass- Parameters:
controller- The controller instanceaction- The action name- Returns:
- The result of the action
- Throws:
java.lang.Throwable
-
actionUriToViewName
public java.lang.String actionUriToViewName(java.lang.String actionUri)
- Specified by:
actionUriToViewNamein interfaceGrailsControllerClass
-
-