Class JNode
- java.lang.Object
- 
- com.inductiveautomation.snap.javatree.JNode
 
- 
- Direct Known Subclasses:
- JEnumConstant,- JExpr,- JFile,- JImportDecl,- JMemberDecl,- JPackageDecl,- JStmt,- JStmtSwitch.SwitchLabel,- JStmtTry.CatchBlock,- JType,- JTypeParam,- JVariableDecl
 
 public class JNode extends java.lang.ObjectThe base class for all nodes of a JFile.
- 
- 
Constructor SummaryConstructors Constructor Description JNode()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddChild(JNode aNode)Add child node to list.protected voidbuildChildren()Initializes children list by adding children from IVars.JStmtBlockgetBlock()Returns the statement block.JNodegetChild(int anIndex)Returns the individual child node at given index.intgetChildCount()Returns the number of child nodes.java.util.List<JNode>getChildren()Returns the array of child nodes.WebClassLoadergetClassLoader()Returns the class loader used to resolve classes.java.lang.StringgetClassName()Returns the class name for this node, if it has one.protected java.lang.StringgetClassNameImpl()Tries to resolve the class name for this node.JClassRefgetClassRef()Returns the class reference for this node.protected JClassRefgetClassRefImpl()Returns the class reference for this node.JClassDeclgetEnclosingClassDecl()Returns the enclosing class.JMemberDeclgetEnclosingMemberDecl()Returns the enclosing member declaration, if in member.JMethodDeclgetEnclosingMethodDecl()Returns the enclosing method declaration, if in method.intgetEnd()Returns the end char index of this node.TokengetEndToken()Returns the end token of this node.JFilegetFile()Returns the parent file node (root).java.lang.ClassgetJClass()Returns the Class of this node, if it has one.intgetLineIndex()Returns the line index of this node.java.lang.StringgetName()Returns the node name, if it has one.protected java.lang.StringgetNameImpl()Resolves the name, if possible.JNodegetNodeAtCharIndex(int anIndex)Returns the node at given char index.protected java.lang.reflect.Field[]getNodeFields()Returns fields for class.protected java.lang.reflect.Field[]getNodeFieldsImpl()Returns fields for this class.java.util.List<JNode>getNodeParents()Returns the node path.java.lang.StringgetNodePath(java.lang.String aSep)Returns the node parent path, with separator.java.lang.StringgetNodeString()Returns the node name.java.util.List<JNode>getOthers()Returns a list of other nodes that represent the same symbol as this node.JNodegetParent()Returns the parent node.<T> TgetParent(java.lang.Class<T> aClass)Returns the parent node of given class.java.util.List<java.lang.Class>getReferencedClasses()Returns the list of references for a JClass.java.util.List<java.lang.String>getReferencedClassNames()Returns the list of references for a JClass.java.util.List<java.lang.String>getReferencedClassNames(boolean doClassFilesOnly)Returns the list of references for a JClass.protected voidgetReferencedClassNames(java.util.Set aSet, boolean doClassFilesOnly)Loads the list of references for a JNode.intgetStart()Returns the start char index of this node.TokengetStartToken()Returns the start token of this node.java.lang.StringgetString()Returns the string for this node (from Token.Tokenizer.getInput(Start,End)).JVariableDeclgetVariableDecl(java.lang.String aName)Returns a variable with given name.JVariableDeclgetVariableDeclInside(java.lang.String aName)Returns a variable inside this node with given name.java.util.List<JVariableDecl>getVariableDecls(java.lang.String aPrefix, java.util.List<JVariableDecl> theVariables)Fills a given list with variables that start with given prefix.booleanisBlock()Returns whether statement has a block associated with it.protected voidsetClassName(java.lang.String aName)Sets the class name for this node.protected voidsetClassRef(JClassRef aCRef)Returns the class reference for this node.voidsetEndToken(Token aToken)Sets the end token of this node.protected voidsetJClass(java.lang.Class aClass)Sets the JClassRef of this node from given class.voidsetParent(JNode aParent)Sets the parent node.voidsetStartToken(Token aToken)Sets the start token of this node.java.lang.StringtoString()Standard toString implementation.
 
- 
- 
- 
Method Detail- 
getFilepublic JFile getFile() Returns the parent file node (root).
 - 
getNamepublic java.lang.String getName() Returns the node name, if it has one.
 - 
getNameImplprotected java.lang.String getNameImpl() Resolves the name, if possible.
 - 
getClassLoaderpublic WebClassLoader getClassLoader() Returns the class loader used to resolve classes.
 - 
getEnclosingClassDeclpublic JClassDecl getEnclosingClassDecl() Returns the enclosing class.
 - 
getEnclosingMethodDeclpublic JMethodDecl getEnclosingMethodDecl() Returns the enclosing method declaration, if in method.
 - 
getEnclosingMemberDeclpublic JMemberDecl getEnclosingMemberDecl() Returns the enclosing member declaration, if in member.
 - 
getClassNamepublic java.lang.String getClassName() Returns the class name for this node, if it has one.
 - 
getClassNameImplprotected java.lang.String getClassNameImpl() Tries to resolve the class name for this node.
 - 
setClassNameprotected void setClassName(java.lang.String aName) Sets the class name for this node.
 - 
getClassRefpublic JClassRef getClassRef() Returns the class reference for this node.
 - 
getClassRefImplprotected JClassRef getClassRefImpl() Returns the class reference for this node.
 - 
setClassRefprotected void setClassRef(JClassRef aCRef) Returns the class reference for this node.
 - 
getJClasspublic java.lang.Class getJClass() Returns the Class of this node, if it has one.
 - 
setJClassprotected void setJClass(java.lang.Class aClass) Sets the JClassRef of this node from given class.
 - 
getStartTokenpublic Token getStartToken() Returns the start token of this node.
 - 
setStartTokenpublic void setStartToken(Token aToken) Sets the start token of this node.
 - 
getStartpublic int getStart() Returns the start char index of this node.
 - 
getEndTokenpublic Token getEndToken() Returns the end token of this node.
 - 
setEndTokenpublic void setEndToken(Token aToken) Sets the end token of this node.
 - 
getEndpublic int getEnd() Returns the end char index of this node.
 - 
getLineIndexpublic int getLineIndex() Returns the line index of this node.
 - 
getParentpublic JNode getParent() Returns the parent node.
 - 
setParentpublic void setParent(JNode aParent) Sets the parent node.
 - 
getParentpublic <T> T getParent(java.lang.Class<T> aClass) Returns the parent node of given class.
 - 
getChildCountpublic final int getChildCount() Returns the number of child nodes.
 - 
getChildpublic final JNode getChild(int anIndex) Returns the individual child node at given index.
 - 
getChildrenpublic java.util.List<JNode> getChildren() Returns the array of child nodes.
 - 
addChildprotected void addChild(JNode aNode) Add child node to list.
 - 
buildChildrenprotected void buildChildren() Initializes children list by adding children from IVars.
 - 
getNodeFieldsprotected java.lang.reflect.Field[] getNodeFields() Returns fields for class.
 - 
getNodeFieldsImplprotected java.lang.reflect.Field[] getNodeFieldsImpl() Returns fields for this class.
 - 
isBlockpublic boolean isBlock() Returns whether statement has a block associated with it.
 - 
getBlockpublic JStmtBlock getBlock() Returns the statement block.
 - 
getNodeAtCharIndexpublic JNode getNodeAtCharIndex(int anIndex) Returns the node at given char index.
 - 
getVariableDeclpublic JVariableDecl getVariableDecl(java.lang.String aName) Returns a variable with given name.
 - 
getVariableDeclInsidepublic JVariableDecl getVariableDeclInside(java.lang.String aName) Returns a variable inside this node with given name.
 - 
getVariableDeclspublic java.util.List<JVariableDecl> getVariableDecls(java.lang.String aPrefix, java.util.List<JVariableDecl> theVariables) Fills a given list with variables that start with given prefix.
 - 
getNodeParentspublic java.util.List<JNode> getNodeParents() Returns the node path.
 - 
getNodePathpublic java.lang.String getNodePath(java.lang.String aSep) Returns the node parent path, with separator.
 - 
getNodeStringpublic java.lang.String getNodeString() Returns the node name.
 - 
getReferencedClassNamespublic java.util.List<java.lang.String> getReferencedClassNames() Returns the list of references for a JClass.
 - 
getReferencedClassNamespublic java.util.List<java.lang.String> getReferencedClassNames(boolean doClassFilesOnly) Returns the list of references for a JClass.
 - 
getReferencedClassNamesprotected void getReferencedClassNames(java.util.Set aSet, boolean doClassFilesOnly)Loads the list of references for a JNode.
 - 
getReferencedClassespublic java.util.List<java.lang.Class> getReferencedClasses() Returns the list of references for a JClass.
 - 
getOtherspublic java.util.List<JNode> getOthers() Returns a list of other nodes that represent the same symbol as this node.
 - 
getStringpublic final java.lang.String getString() Returns the string for this node (from Token.Tokenizer.getInput(Start,End)).
 - 
toString@Nonnull public final java.lang.String toString() Standard toString implementation.- Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-