public class ObjectGraphBuilder extends FactoryBuilderSupport
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.
Modifiers | Name | Description |
---|---|---|
interface |
ObjectGraphBuilder.ChildPropertySetter |
Strategy for setting a child node on its parent. |
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 and childName accordingly. |
interface |
ObjectGraphBuilder.IdentifierResolver |
Strategy for picking the correct synthetic identifier. |
interface |
ObjectGraphBuilder.NewInstanceResolver |
Strategy for creating new instances of a class. |
interface |
ObjectGraphBuilder.ReferenceResolver |
Strategy for picking the correct synthetic reference identifier. |
class |
ObjectGraphBuilder.ReflectionClassNameResolver |
Build objects using reflection to resolve class names. |
interface |
ObjectGraphBuilder.RelationNameResolver |
Strategy for resolving a relationship property name. |
Modifiers | Name | Description |
---|---|---|
static String |
CLASSNAME_RESOLVER_KEY |
|
static String |
CLASSNAME_RESOLVER_REFLECTION |
|
static String |
CLASSNAME_RESOLVER_REFLECTION_ROOT |
|
static String |
LAZY_REF |
|
static String |
NODE_CLASS |
|
static String |
NODE_NAME |
|
static String |
OBJECT_ID |
Fields inherited from class | Fields |
---|---|
class FactoryBuilderSupport |
CHILD_BUILDER, CURRENT_BUILDER, CURRENT_FACTORY, CURRENT_NAME, CURRENT_NODE, OWNER, PARENT_BUILDER, PARENT_CONTEXT, PARENT_FACTORY, PARENT_NAME, PARENT_NODE, SCRIPT_CLASS_NAME |
Constructor and description |
---|
ObjectGraphBuilder() |
Type Params | Return Type | Name and description |
---|---|---|
|
public void |
doCall(ObjectGraphBuilder builder, Object parent, Object node) |
|
public String |
getBeanFactoryName() Returns the current name of the 'bean' node. |
|
public ObjectGraphBuilder.ChildPropertySetter |
getChildPropertySetter() Returns the current ChildPropertySetter. |
|
public ClassLoader |
getClassLoader() Returns the classLoader used to load a node's class. |
|
public ClassNameResolver |
getClassNameResolver() Returns the current ClassNameResolver. |
|
public NewInstanceResolver |
getNewInstanceResolver() Returns the current NewInstanceResolver. |
|
public ObjectGraphBuilder.RelationNameResolver |
getRelationNameResolver() Returns the current RelationNameResolver. |
|
public boolean |
isLazyReferencesAllowed() Returns true if references can be resolved lazily |
|
public void |
setBeanFactoryName(String beanFactoryName) Sets the name for the 'bean' node. |
|
public void |
setChildPropertySetter(Object childPropertySetter) Sets the current ChildPropertySetter. |
|
public void |
setClassLoader(ClassLoader classLoader) Sets the classLoader used to load a node's class. |
|
public void |
setClassNameResolver(Object classNameResolver) Sets the current ClassNameResolver. |
|
public void |
setIdentifierResolver(Object identifierResolver) Sets the current IdentifierResolver. |
|
public void |
setLazyReferencesAllowed(boolean lazyReferencesAllowed) Sets whether references can be resolved lazily or not. |
|
public void |
setNewInstanceResolver(Object newInstanceResolver) Sets the current NewInstanceResolver. |
|
public void |
setReferenceResolver(Object referenceResolver) Sets the current ReferenceResolver. |
|
public void |
setRelationNameResolver(ObjectGraphBuilder.RelationNameResolver relationNameResolver) Sets the current RelationNameResolver. |
Returns the current name of the 'bean' node.
Returns the current ChildPropertySetter.
Returns the classLoader used to load a node's class.
Returns the current ClassNameResolver.
Returns the current NewInstanceResolver.
Returns the current RelationNameResolver.
Returns true if references can be resolved lazily
Sets the name for the 'bean' node.
Sets the current ChildPropertySetter.
It will assign DefaultChildPropertySetter if null.
It accepts a ChildPropertySetter instance or a Closure.
Sets the classLoader used to load a node's class.
Sets the current ClassNameResolver.
It will assign DefaultClassNameResolver if null.
It accepts a ClassNameResolver instance, a String, a Closure or a Map.
Sets the current IdentifierResolver.
It will assign DefaultIdentifierResolver if null.
It accepts a IdentifierResolver instance, a String or a Closure.
Sets whether references can be resolved lazily or not.
Sets the current NewInstanceResolver.
It will assign DefaultNewInstanceResolver if null.
It accepts a NewInstanceResolver instance or a Closure.
Sets the current ReferenceResolver.
It will assign DefaultReferenceResolver if null.
It accepts a ReferenceResolver instance, a String or a Closure.
Sets the current RelationNameResolver.
It will assign DefaultRelationNameResolver if null.
Copyright © 2003-2022 The Apache Software Foundation. All rights reserved.