Class JIdentifier
- java.lang.Object
-
- com.inductiveautomation.snap.javatree.JNode
-
- com.inductiveautomation.snap.javatree.JExpr
-
- com.inductiveautomation.snap.javatree.JIdentifier
-
public class JIdentifier extends JExpr
A JExpr subclass for identifiers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JIdentifier.IdType
-
Nested classes/interfaces inherited from class com.inductiveautomation.snap.javatree.JExpr
JExpr.AllocationExpr, JExpr.ArrayIndexExpr, JExpr.CastExpr
-
-
Constructor Summary
Constructors Constructor Description JIdentifier()
Creates a new identifier.JIdentifier(JType aType)
Creates a new identifier for given JType: this probably needs to go!JIdentifier(java.lang.String aName)
Creates a new identifier for given value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getClassNameImpl()
Tries to resolve the class name for this node.JIdentifier.IdType
getIdentifierType()
Returns the Identifier type: Variable, Field, Class or Package (tries to resolve it if unknown).JMethodCall
getMethodCall()
Returns the method call if parent is method call.JMethodDecl
getMethodDecl()
Returns the method declaration if parent is method declaration.java.lang.String
getNodeString()
Returns the part name.java.util.List<JNode>
getOthers()
Returns a list of other ids for this id.java.lang.String
getPackageName()
Returns the full package name for this package identifier.JVariableDecl
getVariableDecl()
Returns the Identifier variable declaration.boolean
isClassName()
Returns whether this is Class identifier.boolean
isFieldName()
Returns whether this is ClassField identifier.boolean
isMethodName()
Returns whether this identifier is a method name.boolean
isPackageName()
Returns whether this is package identifier.boolean
isVariableId()
Returns whether this is variable identifier.void
setName(java.lang.String aName)
Sets the name for Identifier or Method.protected void
setPackageName(java.lang.String aName)
Returns the full package name for this package identifier.void
setVariableDecl(JVariableDecl aVarDecl)
Sets the Identifier variable declaration.-
Methods inherited from class com.inductiveautomation.snap.javatree.JExpr
getParentClassRef, getParentExpr
-
Methods inherited from class com.inductiveautomation.snap.javatree.JNode
addChild, buildChildren, getBlock, getChild, getChildCount, getChildren, getClassLoader, getClassName, getClassRef, getClassRefImpl, getEnclosingClassDecl, getEnclosingMemberDecl, getEnclosingMethodDecl, getEnd, getEndToken, getFile, getJClass, getLineIndex, getName, getNameImpl, getNodeAtCharIndex, getNodeFields, getNodeFieldsImpl, getNodeParents, getNodePath, getParent, getParent, getReferencedClasses, getReferencedClassNames, getReferencedClassNames, getReferencedClassNames, getStart, getStartToken, getString, getVariableDecl, getVariableDeclInside, getVariableDecls, isBlock, setClassName, setClassRef, setEndToken, setJClass, setParent, setStartToken, toString
-
-
-
-
Constructor Detail
-
JIdentifier
public JIdentifier()
Creates a new identifier.
-
JIdentifier
public JIdentifier(java.lang.String aName)
Creates a new identifier for given value.
-
JIdentifier
public JIdentifier(JType aType)
Creates a new identifier for given JType: this probably needs to go!
-
-
Method Detail
-
setName
public void setName(java.lang.String aName)
Sets the name for Identifier or Method.
-
getIdentifierType
public JIdentifier.IdType getIdentifierType()
Returns the Identifier type: Variable, Field, Class or Package (tries to resolve it if unknown).
-
isVariableId
public boolean isVariableId()
Returns whether this is variable identifier.
-
isClassName
public boolean isClassName()
Returns whether this is Class identifier.
-
isFieldName
public boolean isFieldName()
Returns whether this is ClassField identifier.
-
isMethodName
public boolean isMethodName()
Returns whether this identifier is a method name.
-
getMethodCall
public JMethodCall getMethodCall()
Returns the method call if parent is method call.
-
getMethodDecl
public JMethodDecl getMethodDecl()
Returns the method declaration if parent is method declaration.
-
isPackageName
public boolean isPackageName()
Returns whether this is package identifier.
-
getPackageName
public java.lang.String getPackageName()
Returns the full package name for this package identifier.
-
setPackageName
protected void setPackageName(java.lang.String aName)
Returns the full package name for this package identifier.
-
getVariableDecl
public JVariableDecl getVariableDecl()
Returns the Identifier variable declaration.
-
setVariableDecl
public void setVariableDecl(JVariableDecl aVarDecl)
Sets the Identifier variable declaration.
-
getClassNameImpl
protected java.lang.String getClassNameImpl()
Tries to resolve the class name for this node.- Overrides:
getClassNameImpl
in classJNode
-
getNodeString
public java.lang.String getNodeString()
Returns the part name.- Overrides:
getNodeString
in classJNode
-
-