|
Lombok - v0.10.8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlombok.core.AST<A,L,N>
public abstract class AST<A extends AST<A,L,N>,L extends LombokNode<A,L,N>,N>
Lombok wraps the AST produced by a target platform into its own AST system, mostly because both Eclipse and javac do not allow upward traversal (from a method to its owning type, for example).
| Nested Class Summary | |
|---|---|
protected static class |
AST.FieldAccess
Represents a field that contains AST children. |
static class |
AST.Kind
The kind of node represented by a given AST.Node object. |
| Constructor Summary | |
|---|---|
protected |
AST(String fileName,
String packageDeclaration,
Collection<String> imports)
|
| Method Summary | |
|---|---|
protected abstract L |
buildTree(N item,
AST.Kind kind)
Build an AST.Node object for the stated internal (javac/Eclipse) AST Node object. |
protected Collection<L> |
buildWithField(Class<L> nodeType,
N statement,
AST.FieldAccess fa)
buildTree implementation that uses reflection to find all child nodes by way of inspecting the fields. |
protected void |
clearChanged()
|
protected void |
clearState()
Clears the registry that avoids endless loops, and empties the node map. |
protected Collection<AST.FieldAccess> |
fieldsOf(Class<?> c)
Returns FieldAccess objects for the stated class. |
L |
get(N node)
Maps a javac/Eclipse internal AST Node to the appropriate AST.Node object. |
String |
getFileName()
|
Collection<String> |
getImportStatements()
Return the contents of each non-static import statement on this AST's top (Compilation Unit) node. |
protected Map<N,L> |
getNodeMap()
Returns the node map, that can map javac/Eclipse internal AST objects to AST.Node objects. |
String |
getPackageDeclaration()
Return the content of the package declaration on this AST's top (Compilation Unit) node. |
protected abstract Collection<Class<? extends N>> |
getStatementTypes()
The supertypes which are considered AST Node children. |
boolean |
isChanged()
|
protected L |
putInMap(L node)
Puts the given node in the map so that javac/Eclipse's own internal AST object can be translated to an AST.Node object. |
protected boolean |
replaceStatementInNode(N statement,
N oldN,
N newN)
Uses reflection to find the given direct child on the given statement, and replace it with a new child. |
protected boolean |
setAndGetAsHandled(N node)
Marks the stated node as handled (to avoid endless loops if 2 nodes refer to each other, or a node refers to itself). |
void |
setChanged()
|
protected void |
setElementInASTCollection(Field field,
Object fieldRef,
List<Collection<?>> chain,
Collection<?> collection,
int idx,
N newN)
Override if your AST collection does not support the set method. |
protected void |
setTop(L top)
Set the node object that wraps the internal Compilation Unit node. |
L |
top()
The AST.Node object representing the Compilation Unit. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AST(String fileName,
String packageDeclaration,
Collection<String> imports)
| Method Detail |
|---|
public void setChanged()
protected void clearChanged()
public boolean isChanged()
protected void setTop(L top)
public final String getPackageDeclaration()
public final Collection<String> getImportStatements()
protected L putInMap(L node)
protected Map<N,L> getNodeMap()
protected void clearState()
protected boolean setAndGetAsHandled(N node)
public String getFileName()
public L top()
public L get(N node)
protected abstract L buildTree(N item,
AST.Kind kind)
protected Collection<AST.FieldAccess> fieldsOf(Class<?> c)
getStatementTypes(), either directly or inside of an array or java.util.collection (or array-of-arrays,
or collection-of-collections, etcetera), is returned.
protected abstract Collection<Class<? extends N>> getStatementTypes()
protected Collection<L> buildWithField(Class<L> nodeType,
N statement,
AST.FieldAccess fa)
protected boolean replaceStatementInNode(N statement,
N oldN,
N newN)
protected void setElementInASTCollection(Field field,
Object fieldRef,
List<Collection<?>> chain,
Collection<?> collection,
int idx,
N newN)
throws IllegalAccessException
field - The field that contains the array or list of AST nodes.fieldRef - The object that you can supply to the field's get method.chain - If the collection is immutable, you need to update the pointer to the collection in each element in the chain.
IllegalAccessException - This exception won't happen, but we allow you to throw it so you can avoid having to catch it.
|
Lombok - v0.10.8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||