org.codehaus.groovy.grails.commons
Class GrailsClassUtils

public class GrailsClassUtils
No description provided.
Since08-Jul-200
VersionNot specified.
AuthorGraeme Rocher
Wiki javadoc Use textile entry format.
Add your comments here.
Constructor Summary
GrailsClassUtils()
No description provided.
Method Summary
static String getNaturalName( String name )
Converts a property name into its natural language equivalent eg ('firstName' becomes 'First Name')
static PropertyDescriptor[] getPropertiesOfType( Class clazz, Class propertyType )
Retrieves all the properties of the given class for the given type
static PropertyDescriptor getProperty( Class clazz, String propertyName, Class propertyType )
Retrieves a property of the given class of the specified name and type
static PropertyDescriptor getPropertyDescriptorForValue( Object instance, Object propertyValue )
Retrieves a PropertyDescriptor for the specified instance and property value
static String getPropertyNameRepresentation( Class targetClass )
Returns the property name equivalent for the specified class
static String getPropertyNameRepresentation( String name )
Returns the property name representation of the given name
static Object getPropertyValue( Class clazz, String propertyName, Class propertyType )
Returns the value of the specified property and type from an instance of the specified Grails class
static Class getProperyType( Class clazz, String propertyName )
Returns the type of the given property contained within the specified class
static String getShortName( Class targetClass )
Returns the class name without the package prefix
static boolean isBootstrapClass( Class clazz )
Returns true of the specified Groovy class is a bootstrap
static boolean isControllerClass( Class clazz )
Returns true of the specified Groovy class is a controller
static boolean isControllerClass( String className )
No description provided.
static boolean isDataSource( Class clazz )

Returns true if the specified class is a data source.

static boolean isDomainClass( Class clazz )

Returns true if the specified class is a domain class.

static boolean isPageFlowClass( Class clazz )

Returns true if the specified class is a page flow class type

static boolean isPageFlowClass( String className )
No description provided.
static boolean isPropertyOfType( Class clazz, String propertyName, Class type )
Returns true if the specified property in the specified class is of the specified type
static boolean isService( Class clazz )

Returns true if the specified class is a service.

static boolean isService( String className )
No description provided.
static boolean isTagLibClass( Class clazz )
Returns true of the specified Groovy class is a taglib
static boolean isTagLibClass( String className )
No description provided.
static boolean isTaskClass( Class clazz )
No description provided.
static boolean isTaskClass( String className )
No description provided.
GrailsClassUtils
public GrailsClassUtils ( )
No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
getNaturalName
public static String getNaturalName ( String name )
Converts a property name into its natural language equivalent eg ('firstName' becomes 'First Name')
Parameters
TypeNameDescription
String name The property name to convert
Wiki javadoc Use textile entry format.
Add your comments here.
getPropertiesOfType
public static PropertyDescriptor[] getPropertiesOfType ( Class clazz, Class propertyType )
Retrieves all the properties of the given class for the given type
Parameters
TypeNameDescription
Class clazz The class to retrieve the properties from
Class propertyType The type of the properties you wish to retrieve
Wiki javadoc Use textile entry format.
Add your comments here.
getProperty
public static PropertyDescriptor getProperty ( Class clazz, String propertyName, Class propertyType )
Retrieves a property of the given class of the specified name and type
Parameters
TypeNameDescription
Class clazz The class to retrieve the property from
String propertyName The name of the property
Class propertyType The type of the property
Wiki javadoc Use textile entry format.
Add your comments here.
getPropertyDescriptorForValue
public static PropertyDescriptor getPropertyDescriptorForValue ( Object instance, Object propertyValue )
Retrieves a PropertyDescriptor for the specified instance and property value
Parameters
TypeNameDescription
Object instance The instance
Object propertyValue The value of the property
Wiki javadoc Use textile entry format.
Add your comments here.
getPropertyNameRepresentation
public static String getPropertyNameRepresentation ( Class targetClass )
Returns the property name equivalent for the specified class
Parameters
TypeNameDescription
Class targetClass The class to get the property name for
Wiki javadoc Use textile entry format.
Add your comments here.
getPropertyNameRepresentation
public static String getPropertyNameRepresentation ( String name )
Returns the property name representation of the given name
Parameters
TypeNameDescription
String name The name to convert
Wiki javadoc Use textile entry format.
Add your comments here.
getPropertyValue
public static Object getPropertyValue ( Class clazz, String propertyName, Class propertyType )
Returns the value of the specified property and type from an instance of the specified Grails class
Parameters
TypeNameDescription
Class clazz The name of the class which contains the property
String propertyName The property name
Class propertyType The property type
Wiki javadoc Use textile entry format.
Add your comments here.
getProperyType
public static Class getProperyType ( Class clazz, String propertyName )
Returns the type of the given property contained within the specified class
Parameters
TypeNameDescription
Class clazz The class which contains the property
String propertyName The name of the property
Wiki javadoc Use textile entry format.
Add your comments here.
getShortName
public static String getShortName ( Class targetClass )
Returns the class name without the package prefix
Parameters
TypeNameDescription
Class targetClass No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isBootstrapClass
public static boolean isBootstrapClass ( Class clazz )
Returns true of the specified Groovy class is a bootstrap
Parameters
TypeNameDescription
Class clazz No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isControllerClass
public static boolean isControllerClass ( Class clazz )
Returns true of the specified Groovy class is a controller
Parameters
TypeNameDescription
Class clazz No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isControllerClass
public static boolean isControllerClass ( String className )
No description provided.
Parameters
TypeNameDescription
String className No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isDataSource
public static boolean isDataSource ( Class clazz )

Returns true if the specified class is a data source.

Parameters
TypeNameDescription
Class clazz No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isDomainClass
public static boolean isDomainClass ( Class clazz )

Returns true if the specified class is a domain class. In Grails a domain class is any class that has "id" and "version" properties

Parameters
TypeNameDescription
Class clazz The class to check
Wiki javadoc Use textile entry format.
Add your comments here.
isPageFlowClass
public static boolean isPageFlowClass ( Class clazz )

Returns true if the specified class is a page flow class type

Parameters
TypeNameDescription
Class clazz No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isPageFlowClass
public static boolean isPageFlowClass ( String className )
No description provided.
Parameters
TypeNameDescription
String className No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isPropertyOfType
public static boolean isPropertyOfType ( Class clazz, String propertyName, Class type )
Returns true if the specified property in the specified class is of the specified type
Parameters
TypeNameDescription
Class clazz The class which contains the property
String propertyName The property name
Class type The type to check
Wiki javadoc Use textile entry format.
Add your comments here.
isService
public static boolean isService ( Class clazz )

Returns true if the specified class is a service.

Parameters
TypeNameDescription
Class clazz No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isService
public static boolean isService ( String className )
No description provided.
Parameters
TypeNameDescription
String className No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isTagLibClass
public static boolean isTagLibClass ( Class clazz )
Returns true of the specified Groovy class is a taglib
Parameters
TypeNameDescription
Class clazz No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isTagLibClass
public static boolean isTagLibClass ( String className )
No description provided.
Parameters
TypeNameDescription
String className No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isTaskClass
public static boolean isTaskClass ( Class clazz )
No description provided.
Parameters
TypeNameDescription
Class clazz No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isTaskClass
public static boolean isTaskClass ( String className )
No description provided.
Parameters
TypeNameDescription
String className No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.