Class HiddenFieldCheck.FieldFrame
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck.FieldFrame
-
- Enclosing class:
- HiddenFieldCheck
private static class HiddenFieldCheck.FieldFrame extends java.lang.Object
Holds the names of static and instance fields of a type.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringframeNameName of the frame, such name of the class or enum declaration.private java.util.Set<java.lang.String>instanceFieldsSet of instance field names.private HiddenFieldCheck.FieldFrameparentParent frame.private java.util.Set<java.lang.String>staticFieldsSet of static field names.private booleanstaticTypeIs this a static inner type.
-
Constructor Summary
Constructors Constructor Description FieldFrame(HiddenFieldCheck.FieldFrame parent, boolean staticType, java.lang.String frameName)Creates new frame.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInstanceField(java.lang.String field)Adds an instance field to this FieldFrame.voidaddStaticField(java.lang.String field)Adds a static field to this FieldFrame.booleancontainsInstanceField(java.lang.String field)Determines whether this FieldFrame contains an instance field.booleancontainsStaticField(java.lang.String field)Determines whether this FieldFrame contains a static field.HiddenFieldCheck.FieldFramegetParent()Getter for parent frame.private booleanisEmbeddedIn(java.lang.String classOrEnumName)Check if current frame is embedded in class or enum with specific name.
-
-
-
Field Detail
-
frameName
private final java.lang.String frameName
Name of the frame, such name of the class or enum declaration.
-
staticType
private final boolean staticType
Is this a static inner type.
-
parent
private final HiddenFieldCheck.FieldFrame parent
Parent frame.
-
instanceFields
private final java.util.Set<java.lang.String> instanceFields
Set of instance field names.
-
staticFields
private final java.util.Set<java.lang.String> staticFields
Set of static field names.
-
-
Constructor Detail
-
FieldFrame
FieldFrame(HiddenFieldCheck.FieldFrame parent, boolean staticType, java.lang.String frameName)
Creates new frame.- Parameters:
parent- parent frame.staticType- is this a static inner type (class or enum).frameName- name associated with the frame, which can be a
-
-
Method Detail
-
addInstanceField
public void addInstanceField(java.lang.String field)
Adds an instance field to this FieldFrame.- Parameters:
field- the name of the instance field.
-
addStaticField
public void addStaticField(java.lang.String field)
Adds a static field to this FieldFrame.- Parameters:
field- the name of the instance field.
-
containsInstanceField
public boolean containsInstanceField(java.lang.String field)
Determines whether this FieldFrame contains an instance field.- Parameters:
field- the field to check.- Returns:
- true if this FieldFrame contains instance field field.
-
containsStaticField
public boolean containsStaticField(java.lang.String field)
Determines whether this FieldFrame contains a static field.- Parameters:
field- the field to check.- Returns:
- true if this FieldFrame contains static field field.
-
getParent
public HiddenFieldCheck.FieldFrame getParent()
Getter for parent frame.- Returns:
- parent frame.
-
isEmbeddedIn
private boolean isEmbeddedIn(java.lang.String classOrEnumName)
Check if current frame is embedded in class or enum with specific name.- Parameters:
classOrEnumName- name of class or enum that we are looking for in the chain of field frames.- Returns:
- true if current frame is embedded in class or enum with name classOrNameName
-
-