|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
groovy.lang.Binding
groovy.util.FactoryBuilderSupport
groovy.util.ObjectGraphBuilder
public class ObjectGraphBuilder
A builder for creating object graphs.
Each node defines the class to be created and the property on its parent (if
any) at the same time.
Nested Class Summary | |
---|---|
static interface |
ObjectGraphBuilder.ChildPropertySetter
Strategy for setting a child node on its parent. |
static interface |
ObjectGraphBuilder.ClassNameResolver
Strategy for resolving a classname. |
static class |
ObjectGraphBuilder.DefaultChildPropertySetter
Default impl that calls parent.propertyName = child If parent.propertyName is a Collection it will try to add child to the collection. |
static class |
ObjectGraphBuilder.DefaultClassNameResolver
Default impl that capitalizes the classname. |
static class |
ObjectGraphBuilder.DefaultIdentifierResolver
Default impl, always returns 'id' |
static class |
ObjectGraphBuilder.DefaultNewInstanceResolver
Default impl that calls Class.newInstance() |
static class |
ObjectGraphBuilder.DefaultReferenceResolver
Default impl, always returns 'refId' |
static class |
ObjectGraphBuilder.DefaultRelationNameResolver
Default impl that returns parentName & childName accordingly. |
static interface |
ObjectGraphBuilder.IdentifierResolver
Strategy for picking the correct synthetic identifier. |
static interface |
ObjectGraphBuilder.NewInstanceResolver
Strategy for creating new instances of a class. |
static interface |
ObjectGraphBuilder.ReferenceResolver
Strategy for picking the correct synthetic reference identifier. |
class |
ObjectGraphBuilder.ReflectionClassNameResolver
Build objects using reflection to resolve class names. |
static interface |
ObjectGraphBuilder.RelationNameResolver
Strategy for resolving a relationship property name. |
Field Summary | |
---|---|
static java.lang.String |
CLASSNAME_RESOLVER_KEY
|
static java.lang.String |
CLASSNAME_RESOLVER_REFLECTION
|
static java.lang.String |
CLASSNAME_RESOLVER_REFLECTION_ROOT
|
static java.lang.String |
LAZY_REF
|
static java.lang.String |
NODE_CLASS
|
static java.lang.String |
NODE_NAME
|
static java.lang.String |
OBJECT_ID
|
Constructor Summary | |
---|---|
ObjectGraphBuilder()
|
Method Summary | |
---|---|
java.lang.String |
getBeanFactoryName()
Returns the current name of the 'bean' node. |
ObjectGraphBuilder.ChildPropertySetter |
getChildPropertySetter()
Returns the current ChildPropertySetter. |
java.lang.ClassLoader |
getClassLoader()
Returns the classLoader used to load a node's class. |
ObjectGraphBuilder.ClassNameResolver |
getClassNameResolver()
Returns the current ClassNameResolver. |
ObjectGraphBuilder.NewInstanceResolver |
getNewInstanceResolver()
Returns the current NewInstanceResolver. |
ObjectGraphBuilder.RelationNameResolver |
getRelationNameResolver()
Returns the current RelationNameResolver. |
boolean |
isLazyReferencesAllowed()
Returns true if references can be resolved lazily |
protected void |
postInstantiate(java.lang.Object name,
java.util.Map attributes,
java.lang.Object node)
A hook after the factory creates the node and before attributes are set. |
protected void |
preInstantiate(java.lang.Object name,
java.util.Map attributes,
java.lang.Object value)
A hook before the factory creates the node. |
protected Factory |
resolveFactory(java.lang.Object name,
java.util.Map attributes,
java.lang.Object value)
This is a hook for subclasses to plugin a custom strategy for mapping names to factories. |
void |
setBeanFactoryName(java.lang.String beanFactoryName)
Sets the name for the 'bean' node. |
void |
setChildPropertySetter(java.lang.Object childPropertySetter)
Sets the current ChildPropertySetter. |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Sets the classLoader used to load a node's class. |
void |
setClassNameResolver(java.lang.Object classNameResolver)
Sets the current ClassNameResolver. |
void |
setIdentifierResolver(java.lang.Object identifierResolver)
Sets the current IdentifierResolver. |
void |
setLazyReferencesAllowed(boolean lazyReferencesAllowed)
Sets whether references can be resolved lazily or not. |
void |
setNewInstanceResolver(java.lang.Object newInstanceResolver)
Sets the current NewInstanceResolver. |
void |
setReferenceResolver(java.lang.Object referenceResolver)
Sets the current ReferenceResolver. |
void |
setRelationNameResolver(ObjectGraphBuilder.RelationNameResolver relationNameResolver)
Sets the current RelationNameResolver. |
Methods inherited from class groovy.lang.GroovyObjectSupport |
---|
getMetaClass, setMetaClass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NODE_CLASS
public static final java.lang.String NODE_NAME
public static final java.lang.String OBJECT_ID
public static final java.lang.String LAZY_REF
public static final java.lang.String CLASSNAME_RESOLVER_KEY
public static final java.lang.String CLASSNAME_RESOLVER_REFLECTION
public static final java.lang.String CLASSNAME_RESOLVER_REFLECTION_ROOT
Constructor Detail |
---|
public ObjectGraphBuilder()
Method Detail |
---|
public java.lang.String getBeanFactoryName()
public ObjectGraphBuilder.ChildPropertySetter getChildPropertySetter()
public java.lang.ClassLoader getClassLoader()
public ObjectGraphBuilder.ClassNameResolver getClassNameResolver()
public ObjectGraphBuilder.NewInstanceResolver getNewInstanceResolver()
public ObjectGraphBuilder.RelationNameResolver getRelationNameResolver()
public boolean isLazyReferencesAllowed()
public void setBeanFactoryName(java.lang.String beanFactoryName)
public void setChildPropertySetter(java.lang.Object childPropertySetter)
public void setClassLoader(java.lang.ClassLoader classLoader)
public void setClassNameResolver(java.lang.Object classNameResolver)
public void setIdentifierResolver(java.lang.Object identifierResolver)
public void setLazyReferencesAllowed(boolean lazyReferencesAllowed)
public void setNewInstanceResolver(java.lang.Object newInstanceResolver)
public void setReferenceResolver(java.lang.Object referenceResolver)
public void setRelationNameResolver(ObjectGraphBuilder.RelationNameResolver relationNameResolver)
protected void postInstantiate(java.lang.Object name, java.util.Map attributes, java.lang.Object node)
FactoryBuilderSupport
postInstantiate
in class FactoryBuilderSupport
name
- the name of the nodeattributes
- the attributes for the nodenode
- the object created by the node factoryprotected void preInstantiate(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
FactoryBuilderSupport
preInstantiate
in class FactoryBuilderSupport
name
- the name of the nodeattributes
- the attributes of the nodevalue
- the value argument(s) of the nodeprotected Factory resolveFactory(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
FactoryBuilderSupport
resolveFactory
in class FactoryBuilderSupport
name
- the name of the factoryattributes
- the attributes from the nodevalue
- value arguments from te node
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |