|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ca.ubc.cs.elide.nodes.NodeFactory
Use NodeFactory
to easily create instances of
ClassNode
, FieldNode
, MethodNode
, and TextNode
.
For each of these classes, NodeFactory
takes a string with source
code describing the object, and returns the parsed representation.
Often, it will be easiest to use ELIDE's extended
%{}% string literal syntax with these methods.
Constructor Summary | |
NodeFactory()
|
Method Summary | |
static ClassNode |
createClass(java.lang.String text)
Creates a ClassNode from a String of Java source code
defining the class. |
static FieldNode |
createField(java.lang.String text)
Creates a FieldNode from a String of Java source code
defining the field. |
static MethodNode |
createMethod(java.lang.String text)
Creates a MethodNode from a String of Java source code
defining the class. |
static TextNode |
createText(java.lang.String text)
Creates a TextNode from a String of Java source code. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NodeFactory()
Method Detail |
public static ClassNode createClass(java.lang.String text)
ClassNode
from a String of Java source code
defining the class.
For example:
ClassNode newClass = NodeFactory.createClass(%{ public class Foo { ... } }%);
public static FieldNode createField(java.lang.String text)
FieldNode
from a String of Java source code
defining the field.
For example:
FieldNode newField = NodeFactory.createField(%{ public int x = 3 }%);
In most cases, ClassNode.extend(java.lang.String)
can be used instead.
public static MethodNode createMethod(java.lang.String text)
MethodNode
from a String of Java source code
defining the class.
For example:
MethodNode newMethod = NodeFactory.createMethod(%{ public void foo() { ... } }%);In most cases,
ClassNode.extend(java.lang.String)
can be used instead.public static TextNode createText(java.lang.String text)
TextNode
from a String of Java source code.
For example:
TextNode snippet = NodeFactory.createText(%{ if(x > 0) { doSomething(); } }%);
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |