@SuppressWarnings({ "rawtypes", "unchecked" }) public class GormMappingConfigurationStrategy extends Object implements MappingConfigurationStrategy
This implementation of the MappingConfigurationStrategy interface will interpret GORM-style syntax for defining entities and associations.
Example in Groovy code:
class Author {
String name
static hasMany = [books:Book]
}
class Book {
String title
static belongsTo = [author:Author]
}
| Modifiers | Name | Description |
|---|---|---|
static String |
MAPPED_BY_NONE |
|
protected MappingFactory |
propertyFactory |
| Constructor and description |
|---|
GormMappingConfigurationStrategy(MappingFactory propertyFactory) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
configureOwningSide(Association association) |
|
protected Association |
establishRelationshipForCollection(PropertyDescriptor property, PersistentEntity entity, MappingContext context, Map<String, Class> hasManyMap, Map mappedByMap, boolean embedded) |
|
protected Map |
getAllAssociationMap(ClassPropertyFetcher cpf)Retrieves the association map |
|
public Map |
getAssociationMap(ClassPropertyFetcher cpf)Retrieves the association map |
|
public PersistentProperty[] |
getCompositeIdentity(Class javaClass, MappingContext context) |
|
public IdentityMapping |
getDefaultIdentityMapping(ClassMapping classMapping) |
|
public PersistentProperty |
getIdentity(Class javaClass, MappingContext context) |
|
public IdentityMapping |
getIdentityMapping(ClassMapping classMapping)Obtains the identity mapping for the specified class mapping |
|
protected PersistentEntity |
getOrCreateAssociatedEntity(PersistentEntity entity, MappingContext context, Class propType)Tries to obtain or create an associated entity. |
|
protected PersistentEntity |
getOrCreateEmbeddedEntity(PersistentEntity entity, MappingContext context, Class type)Tries to obtain or create an embedded entity. |
|
public Set |
getOwningEntities(Class javaClass, MappingContext context) |
|
public List<PersistentProperty> |
getPersistentProperties(Class javaClass, MappingContext context) |
|
public List<PersistentProperty> |
getPersistentProperties(Class javaClass, MappingContext context, ClassMapping classMapping) |
|
public List<PersistentProperty> |
getPersistentProperties(PersistentEntity entity, MappingContext context, ClassMapping classMapping, boolean includeIdentifiers) |
|
public List<PersistentProperty> |
getPersistentProperties(PersistentEntity entity, MappingContext context, ClassMapping classMapping) |
|
public static boolean |
isAbstract(PersistentEntity entity) |
|
protected boolean |
isCollectionType(Class type) |
|
protected boolean |
isExcludedProperty(String propertyName, ClassMapping classMapping, Collection transients, boolean includeIdentifiers) |
|
public boolean |
isPersistentEntity(Class clazz)Tests whether a class is a persistent entity |
|
public void |
setCanExpandMappingContext(boolean canExpandMappingContext)Whether the strategy can add new entities to the mapping context |
|
protected boolean |
supportsCustomType(Class<?> propertyType) |
Retrieves the association map
cpf - The ClassPropertyFetcher instanceRetrieves the association map
cpf - The ClassPropertyFetcher instance
Obtains the identity mapping for the specified class mapping
classMapping - The class mappingTries to obtain or create an associated entity. Note that if #canExpandMappingContext is set to false then this method may return null
entity - The main entitycontext - The contextpropType - The associated property typeTries to obtain or create an embedded entity. Note that if #canExpandMappingContext is set to false then this method may return null
entity - The main entitycontext - The contexttype - The associated property typeTests whether a class is a persistent entity
Based on the same method in Grails core within the DomainClassArtefactHandler class
clazz - The java classWhether the strategy can add new entities to the mapping context