public class ObjectGraphBuilder extends FactoryBuilderSupport
Modifier and Type | Class and Description |
---|---|
static interface |
ObjectGraphBuilder.ChildPropertySetter
Strategy for setting a child node on its parent.
Useful for handling Lists/Arrays vs normal properties. |
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.
Useful for plug-in calls to non-default constructors. |
static interface |
ObjectGraphBuilder.ReferenceResolver
Strategy for picking the correct synthetic reference identifier.
|
static interface |
ObjectGraphBuilder.RelationNameResolver
Strategy for resolving a relationship property name.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NODE_CLASS |
static java.lang.String |
NODE_NAME |
static java.lang.String |
OBJECT_ID |
CURRENT_FACTORY, CURRENT_NODE, OWNER, PARENT_CONTEXT, PARENT_FACTORY, PARENT_NODE
Constructor and Description |
---|
ObjectGraphBuilder() |
Modifier and Type | Method and Description |
---|---|
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.
|
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.
It will call any registered postInstantiateDelegates, if you override this method be sure to call this impl somewhere in your code. |
protected void |
preInstantiate(java.lang.Object name,
java.util.Map attributes,
java.lang.Object value)
A hook before the factory creates the node.
It will call any registered preInstantiateDelegates, if you override this method be sure to call this impl somewhere in your code. |
protected Factory |
resolveFactory(java.lang.Object name,
java.util.Map attributes,
java.lang.Object value)
Returns the Factory associated with name.
This is a hook for subclasses to plugin a custom strategy for mapping names to factories. |
void |
setChildPropertySetter(java.lang.Object childPropertySetter)
Sets the current ChildPropertySetter.
It will assign DefaultChildPropertySetter if null. It accepts a ChildPropertySetter instance or a Closure. |
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.
It will assign DefaultClassNameResolver if null. It accepts a ClassNameResolver instance, a String or a Closure. |
void |
setIdentifierResolver(java.lang.Object identifierResolver)
Sets the current IdentifierResolver.
It will assign DefaultIdentifierResolver if null. It accepts a IdentifierResolver instance or a Closure. |
void |
setNewInstanceResolver(java.lang.Object newInstanceResolver)
Sets the current NewInstanceResolver.
It will assign DefaultNewInstanceResolver if null. It accepts a NewInstanceResolver instance or a Closure. |
void |
setReferenceResolver(java.lang.Object referenceResolver)
Sets the current ReferenceResolver.
It will assign DefaultReferenceResolver if null. It accepts a ReferenceResolver instance or a Closure. |
void |
setRelationNameResolver(ObjectGraphBuilder.RelationNameResolver relationNameResolver)
Sets the current RelationNameResolver.
It will assign DefaultRelationNameResolver if null. |
addAttributeDelegate, addDisposalClosure, addPostInstantiateDelegate, addPostNodeCompletionDelegate, addPreInstantiateDelegate, build, build, build, checkValueIsNull, checkValueIsType, checkValueIsTypeNotString, createNode, dispose, getContext, getContexts, getCurrent, getCurrentFactory, getFactories, getName, getParentContext, getParentFactory, getParentNode, getProxyBuilder, handleNodeAttributes, invokeMethod, invokeMethod, newContext, nodeCompleted, popContext, postNodeCompletion, registerBeanFactory, registerFactory, removeAttributeDelegate, removePostInstantiateDelegate, removePostNodeCompletionDelegate, removePreInstantiateDelegate, reset, setClosureDelegate, setNodeAttributes, setParent, setProxyBuilder, withBuilder, withBuilder, withBuilder
getProperty, getVariable, getVariables, setProperty, setVariable
getMetaClass, setMetaClass
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 ObjectGraphBuilder.ChildPropertySetter getChildPropertySetter()
public java.lang.ClassLoader getClassLoader()
public ObjectGraphBuilder.ClassNameResolver getClassNameResolver()
public ObjectGraphBuilder.NewInstanceResolver getNewInstanceResolver()
public ObjectGraphBuilder.RelationNameResolver getRelationNameResolver()
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 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
protected void preInstantiate(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
FactoryBuilderSupport
preInstantiate
in class FactoryBuilderSupport
protected Factory resolveFactory(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
FactoryBuilderSupport
resolveFactory
in class FactoryBuilderSupport