Package groovy.util

# Class AbstractFactory

java.lang.Object
groovy.util.AbstractFactory

All Implemented Interfaces:
  `Factory`

Direct Known Subclasses:
  `CustomizersFactory`, `ImportCustomizerFactory`, `InlinedASTCustomizerFactory`, `SecureASTCustomizerFactory`, `SourceAwareCustomizerFactory`

public abstract class AbstractFactory extends Object implements Factory
Base `Factory` implementation with default no-op lifecycle hooks.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isHandlesNodeChildren()`
  Does this factory "Own" its child closure.
  `boolean`
  `isLeaf()`
  `void`
  `onFactoryRegistration(FactoryBuilderSupport builder, String registeredName, String group)`
  Called when a factory is registered to a builder
  `boolean`
  `onHandleNodeAttributes(FactoryBuilderSupport builder, Object node, Map attributes)`
  `boolean`
  `onNodeChildren(FactoryBuilderSupport builder, Object node, Closure childContent)`
  Only called if it isLeaf is false and isHandlesNodeChildren is true
  `void`
  `onNodeCompleted(FactoryBuilderSupport builder, Object parent, Object node)`
  `void`
  `setChild(FactoryBuilderSupport builder, Object parent, Object child)`
  Notifies the parent that a child node was created.
  `void`
  `setParent(FactoryBuilderSupport builder, Object parent, Object child)`
  Connects a child node to its parent.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface groovy.util.Factory

  `newInstance`

- ## Constructor Details

  - ### AbstractFactory

    public AbstractFactory()

- ## Method Details

  - ### isLeaf

    public boolean isLeaf()
    Specified by:
      `isLeaf` in interface `Factory`
    Returns:
      true if no child closures should be processed

  - ### isHandlesNodeChildren

    public boolean isHandlesNodeChildren()
    Does this factory "Own" its child closure.
    Specified by:
      `isHandlesNodeChildren` in interface `Factory`
    Returns:
      true if the factory should have onContentClosure() called, false if the builder should handle it

  - ### onFactoryRegistration

    public void onFactoryRegistration(FactoryBuilderSupport builder, String registeredName, String group)
    Called when a factory is registered to a builder
    Specified by:
      `onFactoryRegistration` in interface `Factory`
    Parameters:
      `builder` - the build the factory has been registered to
      `registeredName` - the name the factory has been registered under

  - ### onHandleNodeAttributes

    public boolean onHandleNodeAttributes(FactoryBuilderSupport builder, Object node, Map attributes)
    Specified by:
      `onHandleNodeAttributes` in interface `Factory`
    Parameters:
      `builder` - the FactoryBuilder
      `node` - the node (returned from newINstance) to consider the attributes for
      `attributes` - the attributes, a mutable set
    Returns:
      true if the factory builder should use standard bean property matching for the remaining attributes

  - ### onNodeChildren

    public boolean onNodeChildren(FactoryBuilderSupport builder, Object node, Closure childContent)
    Only called if it isLeaf is false and isHandlesNodeChildren is true
    Specified by:
      `onNodeChildren` in interface `Factory`
    Parameters:
      `builder` - the FactoryBuilder
      `node` - the node (returned from newINstance) to consider the attributes for
      `childContent` - the child content closure of the builder
    Returns:
      true if the factory builder should apply default node processing to the content child

  - ### onNodeCompleted

    public void onNodeCompleted(FactoryBuilderSupport builder, Object parent, Object node)
    Specified by:
      `onNodeCompleted` in interface `Factory`
    Parameters:
      `builder` - the FactoryBuilder
      `parent` - the parent node (null if 'root')
      `node` - the node just completed

  - ### setParent

    public void setParent(FactoryBuilderSupport builder, Object parent, Object child)
    Connects a child node to its parent.
    Specified by:
      `setParent` in interface `Factory`
    Parameters:
      `builder` - the FactoryBuilder
      `parent` - the parent node, or `null` for the root
      `child` - the child node

  - ### setChild

    public void setChild(FactoryBuilderSupport builder, Object parent, Object child)
    Notifies the parent that a child node was created.
    Specified by:
      `setChild` in interface `Factory`
    Parameters:
      `builder` - the FactoryBuilder
      `parent` - the parent node, or `null` for the root
      `child` - the child node