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 Object
The base class for all nodes of a JFile.
  • Constructor Details

    • JNode

      public JNode()
  • Method Details

    • getFile

      public JFile getFile()
      Returns the parent file node (root).
    • getName

      public String getName()
      Returns the node name, if it has one.
    • getNameImpl

      protected String getNameImpl()
      Resolves the name, if possible.
    • getClassLoader

      public WebClassLoader getClassLoader()
      Returns the class loader used to resolve classes.
    • getEnclosingClassDecl

      public JClassDecl getEnclosingClassDecl()
      Returns the enclosing class.
    • getEnclosingMethodDecl

      public JMethodDecl getEnclosingMethodDecl()
      Returns the enclosing method declaration, if in method.
    • getEnclosingMemberDecl

      public JMemberDecl getEnclosingMemberDecl()
      Returns the enclosing member declaration, if in member.
    • getClassName

      public String getClassName()
      Returns the class name for this node, if it has one.
    • getClassNameImpl

      protected String getClassNameImpl()
      Tries to resolve the class name for this node.
    • setClassName

      protected void setClassName(String aName)
      Sets the class name for this node.
    • getClassRef

      public JClassRef getClassRef()
      Returns the class reference for this node.
    • getClassRefImpl

      protected JClassRef getClassRefImpl()
      Returns the class reference for this node.
    • setClassRef

      protected void setClassRef(JClassRef aCRef)
      Returns the class reference for this node.
    • getJClass

      public Class getJClass()
      Returns the Class of this node, if it has one.
    • setJClass

      protected void setJClass(Class aClass)
      Sets the JClassRef of this node from given class.
    • getStartToken

      public Token getStartToken()
      Returns the start token of this node.
    • setStartToken

      public void setStartToken(Token aToken)
      Sets the start token of this node.
    • getStart

      public int getStart()
      Returns the start char index of this node.
    • getEndToken

      public Token getEndToken()
      Returns the end token of this node.
    • setEndToken

      public void setEndToken(Token aToken)
      Sets the end token of this node.
    • getEnd

      public int getEnd()
      Returns the end char index of this node.
    • getLineIndex

      public int getLineIndex()
      Returns the line index of this node.
    • getParent

      public JNode getParent()
      Returns the parent node.
    • setParent

      public void setParent(JNode aParent)
      Sets the parent node.
    • getParent

      public <T> T getParent(Class<T> aClass)
      Returns the parent node of given class.
    • getChildCount

      public final int getChildCount()
      Returns the number of child nodes.
    • getChild

      public final JNode getChild(int anIndex)
      Returns the individual child node at given index.
    • getChildren

      public List<JNode> getChildren()
      Returns the array of child nodes.
    • addChild

      protected void addChild(JNode aNode)
      Add child node to list.
    • buildChildren

      protected void buildChildren()
      Initializes children list by adding children from IVars.
    • getNodeFields

      protected Field[] getNodeFields()
      Returns fields for class.
    • getNodeFieldsImpl

      protected Field[] getNodeFieldsImpl()
      Returns fields for this class.
    • isBlock

      public boolean isBlock()
      Returns whether statement has a block associated with it.
    • getBlock

      public JStmtBlock getBlock()
      Returns the statement block.
    • getNodeAtCharIndex

      public JNode getNodeAtCharIndex(int anIndex)
      Returns the node at given char index.
    • getVariableDecl

      public JVariableDecl getVariableDecl(String aName)
      Returns a variable with given name.
    • getVariableDeclInside

      public JVariableDecl getVariableDeclInside(String aName)
      Returns a variable inside this node with given name.
    • getVariableDecls

      public List<JVariableDecl> getVariableDecls(String aPrefix, List<JVariableDecl> theVariables)
      Fills a given list with variables that start with given prefix.
    • getNodeParents

      public List<JNode> getNodeParents()
      Returns the node path.
    • getNodePath

      public String getNodePath(String aSep)
      Returns the node parent path, with separator.
    • getNodeString

      public String getNodeString()
      Returns the node name.
    • getReferencedClassNames

      public List<String> getReferencedClassNames()
      Returns the list of references for a JClass.
    • getReferencedClassNames

      public List<String> getReferencedClassNames(boolean doClassFilesOnly)
      Returns the list of references for a JClass.
    • getReferencedClassNames

      protected void getReferencedClassNames(Set aSet, boolean doClassFilesOnly)
      Loads the list of references for a JNode.
    • getReferencedClasses

      public List<Class> getReferencedClasses()
      Returns the list of references for a JClass.
    • getOthers

      public List<JNode> getOthers()
      Returns a list of other nodes that represent the same symbol as this node.
    • getString

      public final String getString()
      Returns the string for this node (from Token.Tokenizer.getInput(Start,End)).
    • toString

      @Nonnull public final String toString()
      Standard toString implementation.
      Overrides:
      toString in class Object