Package: org.codehaus.groovy.ast.builder

## [Groovy] Class AstSpecificationCompiler

- org.codehaus.groovy.ast.builder.AstSpecificationCompiler

- All Implemented Interfaces and Traits:
    GroovyInterceptable

      @SuppressWarnings(value: BuilderMethodWithSideEffects)
      class AstSpecificationCompiler
      extends Object
      implements GroovyInterceptable

  Handles parsing the properties from the closure into values that can be referenced. This object is very stateful and not threadsafe. It accumulates expressions in the 'expression' field as they are found and executed within the DSL. Note: this class consists of many one-line method calls. A better implementation might be to take a declarative approach and replace the one-liners with map entries.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `AstSpecificationCompiler(Closure spec)` Creates the DSL compiler.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `annotation(Class target, Closure argBlock)` Creates an AnnotationNode.
    `` | `void` | `annotationConstant(Closure argBlock)` Creates an AnnotationConstantExpression.
    `` | `void` | `annotations(Closure argBlock)` Designates a list of AnnotationNodes.
    `` | `void` | `argumentList(Closure argBlock)` Creates an ArgumentListExpression.
    `` | `void` | `array(Class type, Closure argBlock)` Creates an ArrayExpression.
    `` | `void` | `assertStatement(Closure argBlock)` Creates an AssertStatement.
    `` | `void` | `attribute(Closure argBlock)` Creates an AttributeExpression.
    `` | `void` | `binary(Closure argBlock)` Creates a BinaryExpression.
    `` | `void` | `bitwiseNegation(Closure argBlock)` Creates a BitwiseNegationExpression.
    `` | `void` | `block(Closure argBlock)` Creates a BlockStatement.
    `` | `void` | `booleanExpression(Closure argBlock)` Creates a BooleanExpression.
    `` | `void` | `breakStatement(String label)` Creates a BreakStatement.
    `` | `void` | `caseStatement(Closure argBlock)` Create a CaseStatement.
    `` | `void` | `cast(Class type, Closure argBlock)` Creates a CastExpression.
    `` | `void` | `catchStatement(Closure argBlock)` Creates a CatchStatement.
    `` | `void` | `classExpression(Class type)` Creates a ClassExpression.
    `` | `void` | `classNode(Class target)` Creates a ClassNode.
    `` | `void` | `classNode(String name, int modifiers, Closure argBlock)` Creates a ClassNode
    `` | `void` | `closure(Closure argBlock)` Creates a ClosureExpression.
    `` | `void` | `closureList(Closure argBlock)` Creates a ClosureListExpression.
    `` | `void` | `constant(Object value)` Creates a ConstantExpression.
    `` | `void` | `constructor(int modifiers, Closure argBlock)` Creates a ConstructorNode.
    `` | `void` | `constructorCall(Class type, Closure argBlock)` Creates an ConstructorCallExpression.
    `` | `void` | `constructors(Closure argBlock)` Designates a list of ConstructorNodes.
    `` | `void` | `continueStatement(Closure argBlock)` Creates a ContinueStatement.
    `` | `void` | `declaration(Closure argBlock)` Creates a DeclarationExpression.
    `` | `void` | `defaultCase(Closure argBlock)` Creates a BlockStatement.
    `` | `void` | `dynamicVariable(String variable, boolean isStatic)` Creates a DynamicVariable.
    `` | `void` | `elvisOperator(Closure argBlock)` Creates an ElvisOperatorExpression.
    `` | `void` | `empty()` Creates EmptyStatement.
    `` | `void` | `exceptions(Closure argBlock)` Creates a ClassNode[].
    `` | `void` | `expression(Closure argBlock)` Creates an ExpressionStatement.
    `` | `void` | `field(Closure argBlock)` Creates a FieldExpression.
    `` | `void` | `fieldNode(String name, int modifiers, Class type, Class owner, Closure argBlock)` Creates a FieldNode.
    `` | `void` | `fields(Closure argBlock)` Designates a list of `FieldNode`s.
    `` | `void` | `forStatement(Closure argBlock)` Create a ForStatement.
    `` | `void` | `gString(String verbatimText, Closure argBlock)` Creates a gString.
    `` | `void` | `genericsType(Class type, Closure argBlock)` Creates a GenericsType.
    `` | `void` | `genericsTypes(Closure argBlock)` Creates a GenericsTypes[].
    `` | `List<ASTNode>` | `getExpression()` Gets the current generated expression.
    `` | `void` | `ifStatement(Closure argBlock)` Creates an IfStatement.
    `` | `void` | `importNode(Class target, String alias)` Creates an ImportNode.
    `` | `void` | `inclusive(boolean value)` Creates a boolean value.
    `` | `void` | `innerClass(String name, int modifiers, Closure argBlock)` Creates an inner class.
    `` | `void` | `interfaces(Closure argBlock)` Creates a ClassNode[].
    `` | `void` | `label(String label)` Creates a label.
    `` | `void` | `list(Closure argBlock)` Creates a ListExpression.
    `` | `void` | `lowerBound(Class target)` Create lowerBound ClassNode.
    `` | `void` | `map(Closure argBlock)` Creates a MapExpression.
    `` | `void` | `mapEntry(Closure argBlock)` Creates a MapEntryExpression.
    `` | `void` | `mapEntry(Map map)` Creates a mapEntry.
    `` | `void` | `member(String name, Closure argBlock)` Creates a 2 element list of name and Annotation.
    `` | `void` | `method(String name, int modifiers, Class returnType, Closure argBlock)` Creates a MethodNode.
    `` | `void` | `methodCall(Closure argBlock)` Creates a MethodCallExpression.
    `` | `void` | `methodPointer(Closure argBlock)` Creates a methodPointer.
    `` | `void` | `methods(Closure argBlock)` Designates a list of MethodNodes.
    `` | `void` | `mixin(String name, int modifiers, Closure argBlock)` Creates a MixinNode.
    `` | `void` | `mixins(Closure argBlock)` Creates a MixinNode[].
    `` | `void` | `namedArgumentList(Closure argBlock)` Creates a NamedArgumentListExpression.
    `` | `void` | `not(Closure argBlock)` Creates a NotExpression.
    `` | `void` | `parameter(Map<String, Class> args, Closure argBlock)` Creates a Parameter.
    `` | `void` | `parameters(Closure argBlock)` Creates a Parameter[].
    `` | `void` | `postfix(Closure argBlock)` Creates a PostfixExpression.
    `` | `void` | `prefix(Closure argBlock)` Creates a PrefixExpression.
    `` | `void` | `properties(Closure argBlock)` Designates a list of `PropertyNode`s.
    `` | `void` | `property(Closure argBlock)` Creates a property.
    `` | `void` | `propertyNode(String name, int modifiers, Class type, Class owner, Closure argBlock)` Creates a PropertyNode.
    `` | `void` | `range(Closure argBlock)` Creates a RangeExpression.
    `` | `void` | `range(Range range)` Creates a RangeExpression.
    `` | `void` | `returnStatement(Closure argBlock)` Creates a ReturnStatement.
    `` | `void` | `spread(Closure argBlock)` Creates a SpreadExpression.
    `` | `void` | `spreadMap(Closure argBlock)` Creates a SpreadMapExpression.
    `` | `void` | `staticMethodCall(Class target, String name, Closure argBlock)` Creates a StaticMethodCallExpression.
    `` | `void` | `staticMethodCall(MethodClosure target, Closure argBlock)` Creates a StaticMethodCallExpression.
    `` | `void` | `strings(Closure argBlock)` Designates a list of ConstantExpressions.
    `` | `void` | `switchStatement(Closure argBlock)` Creates a SwitchStatement.
    `` | `void` | `synchronizedStatement(Closure argBlock)` Creates a SynchronizedStatement.
    `` | `void` | `throwStatement(Closure argBlock)` Creates a ThrowStatement.
    `` | `void` | `token(String value)` Creates a token.
    `` | `void` | `tryCatch(Closure argBlock)` Creates a TryCatchStatement.
    `` | `void` | `tuple(Closure argBlock)` Creates a TupleExpression.
    `` | `void` | `unaryMinus(Closure argBlock)` Creates a UnaryMinusExpression
    `` | `void` | `unaryPlus(Closure argBlock)` Creates a UnaryPlusExpression.
    `` | `void` | `upperBound(Closure argBlock)` Creates a list of upperBound ClassNodes.
    `` | `void` | `values(Closure argBlock)` Designates a list of Expressions.
    `` | `void` | `variable(String variable)` Creates a VariableExpression.
    `` | `void` | `whileStatement(Closure argBlock)` Creates a WhileStatement.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Constructor Detail

    - #### AstSpecificationCompiler(@DelegatesTo(value: AstSpecificationCompiler)
      Closure spec)

      Creates the DSL compiler.

  - ### Method Detail

    - #### void annotation(Class target, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates an AnnotationNode.

    - #### void annotationConstant(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates an AnnotationConstantExpression.

    - #### void annotations(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Designates a list of AnnotationNodes.

    - #### void argumentList(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates an ArgumentListExpression.

    - #### void array(Class type, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates an ArrayExpression.

    - #### void assertStatement(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates an AssertStatement.

    - #### void attribute(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates an AttributeExpression.

    - #### void binary(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a BinaryExpression.

    - #### void bitwiseNegation(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a BitwiseNegationExpression.

    - #### void block(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a BlockStatement.

    - #### void booleanExpression(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a BooleanExpression.

    - #### void breakStatement(String label)

      Creates a BreakStatement.

    - #### void caseStatement(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Create a CaseStatement.

    - #### void cast(Class type, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a CastExpression.

    - #### void catchStatement(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a CatchStatement.

    - #### void classExpression(Class type)

      Creates a ClassExpression.

    - #### void classNode(Class target)

      Creates a ClassNode.

    - #### void classNode(String name, int modifiers, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a ClassNode

    - #### void closure(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a ClosureExpression.

    - #### void closureList(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a ClosureListExpression.

    - #### void constant(Object value)

      Creates a ConstantExpression.

    - #### void constructor(int modifiers, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a ConstructorNode.

    - #### void constructorCall(Class type, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates an ConstructorCallExpression.

    - #### void constructors(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Designates a list of ConstructorNodes.

    - #### void continueStatement(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a ContinueStatement.

    - #### void declaration(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a DeclarationExpression.

    - #### void defaultCase(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a BlockStatement.

    - #### void dynamicVariable(String variable, boolean isStatic)

      Creates a DynamicVariable.

    - #### void elvisOperator(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates an ElvisOperatorExpression.

    - #### void empty()

      Creates EmptyStatement.

    - #### void exceptions(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a ClassNode[].

    - #### @SuppressWarnings(value: ConfusingMethodName)
      void expression(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates an ExpressionStatement.

    - #### void field(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a FieldExpression.

    - #### void fieldNode(String name, int modifiers, Class type, Class owner, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a FieldNode.

    - #### void fields(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Designates a list of `FieldNode`s.

    - #### void forStatement(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Create a ForStatement.

    - #### void gString(String verbatimText, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a gString.

    - #### void genericsType(Class type, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a GenericsType.

    - #### void genericsTypes(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a GenericsTypes[].

    - #### List<ASTNode> getExpression()

      Gets the current generated expression.

    - #### void ifStatement(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates an IfStatement.

    - #### void importNode(Class target, String alias)

      Creates an ImportNode.

    - #### void inclusive(boolean value)

      Creates a boolean value.

    - #### void innerClass(String name, int modifiers, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates an inner class.

    - #### void interfaces(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a ClassNode[].

    - #### void label(String label)

      Creates a label.

    - #### void list(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a ListExpression.

    - #### void lowerBound(Class target)

      Create lowerBound ClassNode.

    - #### void map(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a MapExpression.

    - #### void mapEntry(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a MapEntryExpression.

    - #### void mapEntry(Map map)

      Creates a mapEntry.

    - #### void member(String name, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a 2 element list of name and Annotation. Used with Annotation Members.

    - #### void method(String name, int modifiers, Class returnType, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a MethodNode.

    - #### void methodCall(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a MethodCallExpression.

    - #### void methodPointer(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a methodPointer.

    - #### void methods(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Designates a list of MethodNodes.

    - #### void mixin(String name, int modifiers, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a MixinNode.

    - #### void mixins(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a MixinNode[].

    - #### void namedArgumentList(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a NamedArgumentListExpression.

    - #### void not(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a NotExpression.

    - #### void parameter(Map<String, Class> args, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a Parameter.

    - #### void parameters(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a Parameter[].

    - #### void postfix(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a PostfixExpression.

    - #### void prefix(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a PrefixExpression.

    - #### void properties(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Designates a list of `PropertyNode`s.

    - #### void property(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a property.

    - #### void propertyNode(String name, int modifiers, Class type, Class owner, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a PropertyNode.

    - #### void range(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a RangeExpression.

    - #### void range(Range range)

      Creates a RangeExpression.

    - #### void returnStatement(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a ReturnStatement.

    - #### void spread(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a SpreadExpression.

    - #### void spreadMap(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a SpreadMapExpression.

    - #### void staticMethodCall(Class target, String name, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a StaticMethodCallExpression.

    - #### void staticMethodCall(MethodClosure target, @DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a StaticMethodCallExpression.

    - #### void strings(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Designates a list of ConstantExpressions.

    - #### void switchStatement(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a SwitchStatement.

    - #### void synchronizedStatement(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a SynchronizedStatement.

    - #### void throwStatement(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a ThrowStatement.

    - #### void token(String value)

      Creates a token.

    - #### void tryCatch(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a TryCatchStatement.

    - #### void tuple(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a TupleExpression.

    - #### void unaryMinus(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a UnaryMinusExpression

    - #### void unaryPlus(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a UnaryPlusExpression.

    - #### void upperBound(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a list of upperBound ClassNodes.

    - #### void values(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Designates a list of Expressions.

    - #### void variable(String variable)

      Creates a VariableExpression.

    - #### void whileStatement(@DelegatesTo(value: AstSpecificationCompiler)
      Closure argBlock)

      Creates a WhileStatement.