Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.sequencer.ddl.node
Class AstNodeFactory

    java.lang.Object
      org.modeshape.sequencer.ddl.node.AstNodeFactory

    public final class AstNodeFactory

extends Object

Utility class which provides construction, editing and assorted methods to work with AstNodes.

Constructor Summary
`AstNodeFactory()`

Method Summary
`AstNode` | `getChildforNameAndType(AstNode astNode, String name, String nodeType)` Utility method to obtain a `AstNode` child of a parent `AstNode` with the given string name and node type.
`List<AstNode>` | `getChildrenForType(AstNode astNode, String nodeType)` Utility method to obtain the children of a given node that match the given type
`boolean` | `hasMixinType(AstNode node, String mixinType)` Utility method to determine if an `AstNode` contains a specific mixin type.
`AstNode` | `node(String name)` Constructs an `AstNode` with the given string name
`AstNode` | `node(String name, AstNode parent, Object... types)` Constructs an `AstNode` with the given name, types and parent node.
`AstNode` | `node(String name, AstNode parent, String type)` Constructs an `AstNode` with the given name, type and parent node.
`void` | `setType(AstNode node, String type)` Sets the mixin type property for an `AstNode`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AstNodeFactory

    public AstNodeFactory()

Method Detail

### node

    public AstNode node(String name)

  Constructs an `AstNode` with the given string name

  Parameters:
    `name` - the name property of the node; may not be null
  Returns:
    the tree node

### node

    public AstNode node(String name,
                        AstNode parent,
                        Object... types)

  Constructs an `AstNode` with the given name, types and parent node.

  Parameters:
    `name` - the name property of the node; may not be null
    `parent` - the parent of the node; may not be null
    `types` - the mixin types; may not be null, but may be empty
  Returns:
    the tree node

### node

    public AstNode node(String name,
                        AstNode parent,
                        String type)

  Constructs an `AstNode` with the given name, type and parent node.

  Parameters:
    `name` - the name property of the node; may not be null
    `parent` - the parent of the node; may not be null
    `type` - the mixin type `String` for the requested node; may not be null
  Returns:
    the tree node

### setType

    public void setType(AstNode node,
                        String type)

  Sets the mixin type property for an `AstNode`

  Parameters:
    `node` - the node to set the property on; may not be null
    `type` - the mixin type `String`; may not be null

### getChildrenForType

    public List<AstNode> getChildrenForType(AstNode astNode,
                                            String nodeType)

  Utility method to obtain the children of a given node that match the given type

  Parameters:
    `astNode` - the parent node; may not be null
    `nodeType` - the type property of the target child node; may not be null
  Returns:
    the list of typed nodes (may be empty)

### getChildforNameAndType

    public AstNode getChildforNameAndType(AstNode astNode,
                                          String name,
                                          String nodeType)

  Utility method to obtain a `AstNode` child of a parent `AstNode` with the given string name and node type.

  Parameters:
    `astNode` - the parent node; may not be null
    `name` - the name property of the node; may not be null
    `nodeType` - the type property of the target child node; may not be null
  Returns:
    the matched child (may be null)

### hasMixinType

    public boolean hasMixinType(AstNode node,
                                String mixinType)

  Utility method to determine if an `AstNode` contains a specific mixin type.

  Parameters:
    `node` - the AstNode
    `mixinType` - the target mixin type `String`; may not be null;
  Returns:
    true if the mixinType exists for this node

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.