Class FullIdent
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.api.FullIdent
-
public final class FullIdent extends java.lang.ObjectRepresents a full identifier, including dots, with associated position information.Identifiers such as
java.util.HashMapare spread across multiple AST nodes in the syntax tree (three IDENT nodes, two DOT nodes). A FullIdent represents the whole String (excluding any intermediate whitespace), which is often easier to work with in Checks.- See Also:
TokenTypes.DOT,TokenTypes.IDENT
-
-
Constructor Summary
Constructors Modifier Constructor Description privateFullIdent()Hide default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidappend(DetailAST ast)Append the specified token and also recalibrate the first line and column.private voidappend(java.lang.String text)Append the specified text.static FullIdentcreateFullIdent(DetailAST ast)Creates a new FullIdent starting from the specified node.static FullIdentcreateFullIdentBelow(DetailAST ast)Creates a new FullIdent starting from the child of the specified node.private static voidextractFullIdent(FullIdent full, DetailAST ast)Recursively extract a FullIdent.intgetColumnNo()Gets the column number.intgetLineNo()Gets the line number.java.lang.StringgetText()Gets the text.java.lang.StringtoString()
-
-
-
Method Detail
-
createFullIdent
public static FullIdent createFullIdent(DetailAST ast)
Creates a new FullIdent starting from the specified node.- Parameters:
ast- the node to start from- Returns:
- a
FullIdentvalue
-
createFullIdentBelow
public static FullIdent createFullIdentBelow(DetailAST ast)
Creates a new FullIdent starting from the child of the specified node.- Parameters:
ast- the parent node from where to start from- Returns:
- a
FullIdentvalue
-
getText
public java.lang.String getText()
Gets the text.- Returns:
- the text
-
getLineNo
public int getLineNo()
Gets the line number.- Returns:
- the line number
-
getColumnNo
public int getColumnNo()
Gets the column number.- Returns:
- the column number
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
extractFullIdent
private static void extractFullIdent(FullIdent full, DetailAST ast)
Recursively extract a FullIdent.- Parameters:
full- the FullIdent to add toast- the node to recurse from
-
append
private void append(java.lang.String text)
Append the specified text.- Parameters:
text- the text to append
-
append
private void append(DetailAST ast)
Append the specified token and also recalibrate the first line and column.- Parameters:
ast- the token to append
-
-