Overview | Package | Class | Deprecated | Index | Help
| Groovy 1.7.0
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.util
Class ObjectGraphBuilder

    java.lang.Object
      groovy.lang.GroovyObjectSupport
          groovy.lang.Binding
              groovy.util.FactoryBuilderSupport
                  groovy.util.ObjectGraphBuilder

    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.

author:
  Scott Vlaminck (http://refactr.com)

author:
  Andres Almiray

Nested Class Summary
`interface` | `ObjectGraphBuilder.ChildPropertySetter` Strategy for setting a child node on its parent.
`interface` | `ObjectGraphBuilder.ClassNameResolver` Strategy for resolving a classname.
`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.
`class` | `ObjectGraphBuilder.DefaultClassNameResolver` Default impl that capitalizes the classname.
`class` | `ObjectGraphBuilder.DefaultIdentifierResolver` Default impl, always returns 'id'
`class` | `ObjectGraphBuilder.DefaultNewInstanceResolver` Default impl that calls Class.newInstance()
`class` | `ObjectGraphBuilder.DefaultReferenceResolver` Default impl, always returns 'refId'
`class` | `ObjectGraphBuilder.DefaultRelationNameResolver` Default impl that returns parentName & childName accordingly.
`interface` | `ObjectGraphBuilder.IdentifierResolver` Strategy for picking the correct synthetic identifier.
`interface` | `ObjectGraphBuilder.NewInstanceResolver` Strategy for creating new instances of a class.
`class` | `ObjectGraphBuilder.NodeReference`
`class` | `ObjectGraphBuilder.ObjectBeanFactory`
`class` | `ObjectGraphBuilder.ObjectFactory`
`class` | `ObjectGraphBuilder.ObjectRefFactory`
`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.

Field Summary
`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 FactoryBuilderSupport
attributeDelegates, autoRegistrationComplete, autoRegistrationRunning, explicitMethods, explicitProperties, postInstantiateDelegates, postNodeCompletionDelegates, preInstantiateDelegates, registrationGroup, registrationGroupName

Constructor Summary
`ObjectGraphBuilder()`

Method Summary
`String` | `getBeanFactoryName()` Returns the current name of the 'bean' node.
`ChildPropertySetter` | `getChildPropertySetter()` Returns the current ChildPropertySetter.
`ClassLoader` | `getClassLoader()` Returns the classLoader used to load a node's class.
`ClassNameResolver` | `getClassNameResolver()` Returns the current ClassNameResolver.
`NewInstanceResolver` | `getNewInstanceResolver()` Returns the current NewInstanceResolver.
`RelationNameResolver` | `getRelationNameResolver()` Returns the current RelationNameResolver.
`boolean` | `isLazyReferencesAllowed()` Returns true if references can be resolved lazily
`protected void` | `postInstantiate(Object name, Map attributes, Object node)`
`protected void` | `preInstantiate(Object name, Map attributes, Object value)`
`protected Factory` | `resolveFactory(Object name, Map attributes, Object value)`
`void` | `setBeanFactoryName(String beanFactoryName)` Sets the name for the 'bean' node.
`void` | `setChildPropertySetter(Object childPropertySetter)` Sets the current ChildPropertySetter.
`void` | `setClassLoader(ClassLoader classLoader)` Sets the classLoader used to load a node's class.
`void` | `setClassNameResolver(Object classNameResolver)` Sets the current ClassNameResolver.
`void` | `setIdentifierResolver(Object identifierResolver)` Sets the current IdentifierResolver.
`void` | `setLazyReferencesAllowed(boolean lazyReferencesAllowed)` Sets whether references can be resolved lazily or not.
`void` | `setNewInstanceResolver(Object newInstanceResolver)` Sets the current NewInstanceResolver.
`void` | `setReferenceResolver(Object referenceResolver)` Sets the current ReferenceResolver.
`void` | `setRelationNameResolver(RelationNameResolver relationNameResolver)` Sets the current RelationNameResolver.

Methods inherited from class FactoryBuilderSupport
addAttributeDelegate, addDisposalClosure, addPostInstantiateDelegate, addPostNodeCompletionDelegate, addPreInstantiateDelegate, autoRegisterNodes, build, build, build, checkExplicitMethod, checkValueIsNull, checkValueIsType, checkValueIsTypeNotString, createNode, dispathNodeCall, dispose, getAttributeDelegates, getChildBuilder, getContext, getContextAttribute, getContexts, getContinuationData, getCurrent, getCurrentBuilder, getCurrentFactory, getCurrentName, getExplicitMethods, getExplicitProperties, getFactories, getLocalExplicitMethods, getLocalExplicitProperties, getLocalFactories, getName, getNameMappingClosure, getParentContext, getParentFactory, getParentName, getParentNode, getPostInstantiateDelegates, getPostNodeCompletionDelegates, getPreInstantiateDelegates, getProperty, getProxyBuilder, getRegistrationGroupItems, getRegistrationGroups, getVariable, getVariables, handleNodeAttributes, invokeMethod, invokeMethod, newContext, nodeCompleted, popContext, postInstantiate, postNodeCompletion, preInstantiate, registerBeanFactory, registerBeanFactory, registerExplicitMethod, registerExplicitMethod, registerExplicitProperty, registerExplicitProperty, registerFactory, registerFactory, removeAttributeDelegate, removePostInstantiateDelegate, removePostNodeCompletionDelegate, removePreInstantiateDelegate, reset, resolveExplicitMethod, resolveExplicitProperty, resolveFactory, restoreFromContinuationData, setClosureDelegate, setNameMappingClosure, setNodeAttributes, setParent, setProperty, setProxyBuilder, setVariable, withBuilder, withBuilder, withBuilder

Methods inherited from class Binding
getProperty, getVariable, getVariables, setProperty, setVariable

Methods inherited from class GroovyObjectSupport
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty

Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll

Field Detail

### CLASSNAME_RESOLVER_KEY

    static final String CLASSNAME_RESOLVER_KEY

### CLASSNAME_RESOLVER_REFLECTION

    static final String CLASSNAME_RESOLVER_REFLECTION

### CLASSNAME_RESOLVER_REFLECTION_ROOT

    static final String CLASSNAME_RESOLVER_REFLECTION_ROOT

### LAZY_REF

    static final String LAZY_REF

### NODE_CLASS

    static final String NODE_CLASS

### NODE_NAME

    static final String NODE_NAME

### OBJECT_ID

    static final String OBJECT_ID

Constructor Detail

### ObjectGraphBuilder

    public ObjectGraphBuilder()

Method Detail

### getBeanFactoryName

    public String getBeanFactoryName()

  Returns the current name of the 'bean' node.

### getChildPropertySetter

    public ChildPropertySetter getChildPropertySetter()

  Returns the current ChildPropertySetter.

### getClassLoader

    public ClassLoader getClassLoader()

  Returns the classLoader used to load a node's class.

### getClassNameResolver

    public ClassNameResolver getClassNameResolver()

  Returns the current ClassNameResolver.

### getNewInstanceResolver

    public NewInstanceResolver getNewInstanceResolver()

  Returns the current NewInstanceResolver.

### getRelationNameResolver

    public RelationNameResolver getRelationNameResolver()

  Returns the current RelationNameResolver.

### isLazyReferencesAllowed

    public boolean isLazyReferencesAllowed()

  Returns true if references can be resolved lazily

### postInstantiate

    protected void postInstantiate(Object name, Map attributes, Object node)

### preInstantiate

    protected void preInstantiate(Object name, Map attributes, Object value)

### resolveFactory

    protected Factory resolveFactory(Object name, Map attributes, Object value)

### setBeanFactoryName

    public void setBeanFactoryName(String beanFactoryName)

  Sets the name for the 'bean' node.

### setChildPropertySetter

    public void setChildPropertySetter(Object childPropertySetter)

  Sets the current ChildPropertySetter.
  It will assign DefaultChildPropertySetter if null.
  It accepts a ChildPropertySetter instance or a Closure.

### setClassLoader

    public void setClassLoader(ClassLoader classLoader)

  Sets the classLoader used to load a node's class.

### setClassNameResolver

    public void setClassNameResolver(Object classNameResolver)

  Sets the current ClassNameResolver.
  It will assign DefaultClassNameResolver if null.
  It accepts a ClassNameResolver instance, a String, a Closure or a Map.

### setIdentifierResolver

    public void setIdentifierResolver(Object identifierResolver)

  Sets the current IdentifierResolver.
  It will assign DefaultIdentifierResolver if null.
  It accepts a IdentifierResolver instance, a String or a Closure.

### setLazyReferencesAllowed

    public void setLazyReferencesAllowed(boolean lazyReferencesAllowed)

  Sets whether references can be resolved lazily or not.

### setNewInstanceResolver

    public void setNewInstanceResolver(Object newInstanceResolver)

  Sets the current NewInstanceResolver.
  It will assign DefaultNewInstanceResolver if null.
  It accepts a NewInstanceResolver instance or a Closure.

### setReferenceResolver

    public void setReferenceResolver(Object referenceResolver)

  Sets the current ReferenceResolver.
  It will assign DefaultReferenceResolver if null.
  It accepts a ReferenceResolver instance, a String or a Closure.

### setRelationNameResolver

    public void setRelationNameResolver(RelationNameResolver relationNameResolver)

  Sets the current RelationNameResolver.
  It will assign DefaultRelationNameResolver if null.

Copyright © 2003-2009 The Codehaus. All rights reserved.