Class EqualsAvoidNullCheck.FieldFrame
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck.FieldFrame
-
- Enclosing class:
- EqualsAvoidNullCheck
private static final class EqualsAvoidNullCheck.FieldFrame extends Object
Holds the names of fields of a type.
-
-
Field Summary
Fields Modifier and Type Field Description private Set<EqualsAvoidNullCheck.FieldFrame>
children
Set of frame's children.private boolean
classOrEnumOrRecordDef
Whether the frame is CLASS_DEF, ENUM_DEF, ENUM_CONST_DEF, or RECORD_DEF.private Map<String,DetailAST>
fieldNameToAst
Map of field name to field DetailAst.private String
frameName
Name of the class, enum or enum constant declaration.private Set<DetailAST>
methodCalls
Set of equals calls.private EqualsAvoidNullCheck.FieldFrame
parent
Parent frame.
-
Constructor Summary
Constructors Modifier Constructor Description private
FieldFrame(EqualsAvoidNullCheck.FieldFrame parent)
Creates new frame.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(EqualsAvoidNullCheck.FieldFrame child)
Add child frame to this frame.void
addField(DetailAST field)
Add field to this FieldFrame.void
addMethodCall(DetailAST methodCall)
Add method call to this frame.DetailAST
findField(String name)
Determines whether this FieldFrame contains the field.Set<EqualsAvoidNullCheck.FieldFrame>
getChildren()
Getter for frame's children.private static String
getFieldName(DetailAST field)
Get the name of the field.String
getFrameName()
Getter for the frame name.Set<DetailAST>
getMethodCalls()
Getter for frame's method calls.EqualsAvoidNullCheck.FieldFrame
getParent()
Getter for the parent frame.boolean
isClassOrEnumOrRecordDef()
Getter for classOrEnumOrRecordDef.void
setClassOrEnumOrRecordDef(boolean value)
Sets isClassOrEnumOrRecordDef.void
setFrameName(String frameName)
Set the frame name.
-
-
-
Field Detail
-
parent
private final EqualsAvoidNullCheck.FieldFrame parent
Parent frame.
-
children
private final Set<EqualsAvoidNullCheck.FieldFrame> children
Set of frame's children.
-
fieldNameToAst
private final Map<String,DetailAST> fieldNameToAst
Map of field name to field DetailAst.
-
methodCalls
private final Set<DetailAST> methodCalls
Set of equals calls.
-
classOrEnumOrRecordDef
private boolean classOrEnumOrRecordDef
Whether the frame is CLASS_DEF, ENUM_DEF, ENUM_CONST_DEF, or RECORD_DEF.
-
-
Constructor Detail
-
FieldFrame
private FieldFrame(EqualsAvoidNullCheck.FieldFrame parent)
Creates new frame.- Parameters:
parent
- parent frame.
-
-
Method Detail
-
setFrameName
public void setFrameName(String frameName)
Set the frame name.- Parameters:
frameName
- value to set.
-
getFrameName
public String getFrameName()
Getter for the frame name.- Returns:
- frame name.
-
getParent
public EqualsAvoidNullCheck.FieldFrame getParent()
Getter for the parent frame.- Returns:
- parent frame.
-
getChildren
public Set<EqualsAvoidNullCheck.FieldFrame> getChildren()
Getter for frame's children.- Returns:
- children of this frame.
-
addChild
public void addChild(EqualsAvoidNullCheck.FieldFrame child)
Add child frame to this frame.- Parameters:
child
- frame to add.
-
addField
public void addField(DetailAST field)
Add field to this FieldFrame.- Parameters:
field
- the ast of the field.
-
setClassOrEnumOrRecordDef
public void setClassOrEnumOrRecordDef(boolean value)
Sets isClassOrEnumOrRecordDef.- Parameters:
value
- value to set.
-
isClassOrEnumOrRecordDef
public boolean isClassOrEnumOrRecordDef()
Getter for classOrEnumOrRecordDef.- Returns:
- classOrEnumOrRecordDef.
-
addMethodCall
public void addMethodCall(DetailAST methodCall)
Add method call to this frame.- Parameters:
methodCall
- METHOD_CALL ast.
-
findField
public DetailAST findField(String name)
Determines whether this FieldFrame contains the field.- Parameters:
name
- name of the field to check.- Returns:
- DetailAST if this FieldFrame contains instance field.
-
getMethodCalls
public Set<DetailAST> getMethodCalls()
Getter for frame's method calls.- Returns:
- method calls of this frame.
-
getFieldName
private static String getFieldName(DetailAST field)
Get the name of the field.- Parameters:
field
- to get the name from.- Returns:
- name of the field.
-
-