org.codehaus.groovy.grails.commons
Class GrailsDomainConfigurationUtil

java.lang.Object
  extended by org.codehaus.groovy.grails.commons.GrailsDomainConfigurationUtil

public class GrailsDomainConfigurationUtil
extends Object

Utility methods used in configuring the Grails Hibernate integration

Since:
18-Feb-2006
Author:
Graeme Rocher

Constructor Summary
GrailsDomainConfigurationUtil()
           
 
Method Summary
static void configureDomainClassRelationships(GrailsClass[] domainClasses, Map domainMap)
          Configures the relationships between domain classes after they have been all loaded.
static Map evaluateConstraints(Object instance, GrailsDomainClassProperty[] properties)
          Evaluates the constraints closure to build the list of constraints
static Map getAssociationMap(Class domainClass)
          Returns the association map for the specified domain class
static Map getMappedByMap(Class domainClass)
          Retrieves the mappedBy map for the specified class
static String getMappingFileName(String className)
          Returns the ORM frameworks mapping file name for the specified class name
static boolean isBasicType(Class propType)
           
static boolean isBasicType(GrailsDomainClassProperty prop)
          Establish whether its a basic type
static boolean isNotConfigurational(PropertyDescriptor descriptor)
          Checks whether is property is configurational
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrailsDomainConfigurationUtil

public GrailsDomainConfigurationUtil()
Method Detail

configureDomainClassRelationships

public static void configureDomainClassRelationships(GrailsClass[] domainClasses,
                                                     Map domainMap)
Configures the relationships between domain classes after they have been all loaded.

Parameters:
domainClasses - The domain classes to configure relationships for
domainMap - The domain class map

getMappingFileName

public static String getMappingFileName(String className)
Returns the ORM frameworks mapping file name for the specified class name

Parameters:
className - The class name of the mapped file
Returns:
The mapping file name

getAssociationMap

public static Map getAssociationMap(Class domainClass)
Returns the association map for the specified domain class

Parameters:
domainClass - the domain class
Returns:
The association map

getMappedByMap

public static Map getMappedByMap(Class domainClass)
Retrieves the mappedBy map for the specified class

Parameters:
domainClass - The domain class
Returns:
The mappedBy map

isBasicType

public static boolean isBasicType(GrailsDomainClassProperty prop)
Establish whether its a basic type

Parameters:
prop - The domain class property
Returns:
True if it is basic

isBasicType

public static boolean isBasicType(Class propType)

isNotConfigurational

public static boolean isNotConfigurational(PropertyDescriptor descriptor)
Checks whether is property is configurational

Parameters:
descriptor - The descriptor
Returns:
True if it is configurational

evaluateConstraints

public static Map evaluateConstraints(Object instance,
                                      GrailsDomainClassProperty[] properties)
                               throws IntrospectionException
Evaluates the constraints closure to build the list of constraints

Parameters:
instance - The instance to evaluate constraints for
properties - The properties of the instance
Returns:
A Map of constraints
Throws:
IntrospectionException - When the bean cannot be introspected


Copyright (c) 2005-2006 The Grails project