Package org.codehaus.groovy.control.customizers.builder

# Class InlinedASTCustomizerFactory

java.lang.Object
groovy.util.AbstractFactory
org.codehaus.groovy.control.customizers.builder.InlinedASTCustomizerFactory

All Implemented Interfaces:
  `Factory`, `PostCompletionFactory`

public class InlinedASTCustomizerFactory extends AbstractFactory implements PostCompletionFactory
This factory lets a user define a compilation customizer without having to define an anonymous inner class.

Here is an example, which only logs the class name during compilation:

     inline(phase:'CONVERSION') { source, context, classNode ->
         println "visiting $classNode"
     }

Since:
  2.1.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InlinedASTCustomizerFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isHandlesNodeChildren()`
  Indicates that inline customizer nodes accept nested closure content.
  `Object`
  `newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes)`
  Creates the backing map used to build a proxy customizer.
  `boolean`
  `onNodeChildren(FactoryBuilderSupport builder, Object node, Closure childContent)`
  Stores the inline customization closure on the backing node.
  `Object`
  `postCompleteNode(FactoryBuilderSupport factory, Object parent, Object node)`
  Builds the proxy-backed compilation customizer once the node is complete.

  ### Methods inherited from class groovy.util.AbstractFactory

  `isLeaf, onFactoryRegistration, onHandleNodeAttributes, onNodeCompleted, setChild, setParent`

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

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

- ## Constructor Details

  - ### InlinedASTCustomizerFactory

    public InlinedASTCustomizerFactory()

- ## Method Details

  - ### isHandlesNodeChildren

    public boolean isHandlesNodeChildren()
    Indicates that inline customizer nodes accept nested closure content.
    Specified by:
      `isHandlesNodeChildren` in interface `Factory`
    Overrides:
      `isHandlesNodeChildren` in class `AbstractFactory`
    Returns:
      `true`

  - ### newInstance

    public Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException
    Creates the backing map used to build a proxy customizer.
    Specified by:
      `newInstance` in interface `Factory`
    Parameters:
      `builder` - the active builder
      `name` - the node name
      `value` - the supplied node value
      `attributes` - the node attributes
    Returns:
      the backing attribute map
    Throws:
      `InstantiationException` - if instantiation fails
      `IllegalAccessException` - if access fails

  - ### onNodeChildren

    public boolean onNodeChildren(FactoryBuilderSupport builder, Object node, Closure childContent)
    Stores the inline customization closure on the backing node.
    Specified by:
      `onNodeChildren` in interface `Factory`
    Overrides:
      `onNodeChildren` in class `AbstractFactory`
    Parameters:
      `builder` - the active builder
      `node` - the current node
      `childContent` - the nested closure content
    Returns:
      `false` to continue normal processing

  - ### postCompleteNode

    public Object postCompleteNode(FactoryBuilderSupport factory, Object parent, Object node)
    Builds the proxy-backed compilation customizer once the node is complete.
    Specified by:
      `postCompleteNode` in interface `PostCompletionFactory`
    Parameters:
      `factory` - the active builder
      `parent` - the parent node
      `node` - the completed node
    Returns:
      the generated customizer or the original node