private static class RequireThisCheck.ClassFrame extends RequireThisCheck.AbstractFrame
Modifier and Type | Field and Description |
---|---|
private java.util.Set<DetailAST> |
instanceMembers
Set of idents of instance members declared in this frame.
|
private java.util.Set<DetailAST> |
instanceMethods
Set of idents of instance methods declared in this frame.
|
private java.util.Set<DetailAST> |
staticMembers
Set of idents of variables declared in this frame.
|
private java.util.Set<DetailAST> |
staticMethods
Set of idents of static methods declared in this frame.
|
Constructor and Description |
---|
ClassFrame(RequireThisCheck.AbstractFrame parent,
DetailAST ident)
Creates new instance of ClassFrame.
|
Modifier and Type | Method and Description |
---|---|
void |
addInstanceMember(DetailAST ident)
Adds instance member's ident.
|
void |
addInstanceMethod(DetailAST ident)
Adds instance method's name.
|
void |
addStaticMember(DetailAST ident)
Adds static member's ident.
|
void |
addStaticMethod(DetailAST ident)
Adds static method's name.
|
protected boolean |
containsFieldOrVariable(DetailAST nameToFind)
Check whether the frame contains a field or a variable with the given name.
|
private boolean |
containsMethod(DetailAST methodToFind)
Check whether the frame contains a given method.
|
private static boolean |
containsMethodDef(java.util.Set<DetailAST> set,
DetailAST ident)
Whether the set contains a method definition with the
same name and number of parameters.
|
protected RequireThisCheck.AbstractFrame |
getIfContains(DetailAST nameToFind,
boolean lookForMethod)
Check whether the frame contains a given name.
|
protected RequireThisCheck.FrameType |
getType()
Get the type of the frame.
|
boolean |
hasFinalField(DetailAST instanceMember)
Checks whether given instance member has final modifier.
|
boolean |
hasInstanceMember(DetailAST ident)
Checks if a given name is a known instance member of the class.
|
boolean |
hasInstanceMethod(DetailAST ident)
Checks if a given name is a known instance method of the class.
|
boolean |
hasStaticMethod(DetailAST ident)
Checks if a given name is a known static method of the class.
|
protected boolean |
isProperDefinition(DetailAST ident,
DetailAST ast)
Whether the definition is correspondent to the IDENT.
|
private static boolean |
isSimilarSignature(DetailAST ident,
DetailAST ast)
Whether the method definition has the same name and number of parameters.
|
containsFieldOrVariableDef, getFrameName, getFrameNameIdent, getParent
private final java.util.Set<DetailAST> instanceMembers
private final java.util.Set<DetailAST> instanceMethods
private final java.util.Set<DetailAST> staticMembers
private final java.util.Set<DetailAST> staticMethods
ClassFrame(RequireThisCheck.AbstractFrame parent, DetailAST ident)
parent
- parent frame.ident
- frame name ident.protected RequireThisCheck.FrameType getType()
RequireThisCheck.AbstractFrame
getType
in class RequireThisCheck.AbstractFrame
public void addStaticMember(DetailAST ident)
ident
- an ident of static member of the class.public void addStaticMethod(DetailAST ident)
ident
- an ident of static method of the class.public void addInstanceMember(DetailAST ident)
ident
- an ident of instance member of the class.public void addInstanceMethod(DetailAST ident)
ident
- an ident of instance method of the class.public boolean hasInstanceMember(DetailAST ident)
ident
- the IDENT ast of the name to check.public boolean hasInstanceMethod(DetailAST ident)
ident
- the IDENT ast of the method call to check.public boolean hasStaticMethod(DetailAST ident)
ident
- the IDENT ast of the method call to check.public boolean hasFinalField(DetailAST instanceMember)
instanceMember
- an instance member of a class.protected boolean containsFieldOrVariable(DetailAST nameToFind)
RequireThisCheck.AbstractFrame
containsFieldOrVariable
in class RequireThisCheck.AbstractFrame
nameToFind
- the IDENT ast of the name we're looking for.protected boolean isProperDefinition(DetailAST ident, DetailAST ast)
RequireThisCheck.AbstractFrame
isProperDefinition
in class RequireThisCheck.AbstractFrame
ident
- the IDENT ast to check.ast
- the IDENT ast of the definition to check.protected RequireThisCheck.AbstractFrame getIfContains(DetailAST nameToFind, boolean lookForMethod)
RequireThisCheck.AbstractFrame
getIfContains
in class RequireThisCheck.AbstractFrame
nameToFind
- IDENT ast of the name we're looking for.lookForMethod
- whether we are looking for a method name.private boolean containsMethod(DetailAST methodToFind)
methodToFind
- the AST of the method to find.private static boolean containsMethodDef(java.util.Set<DetailAST> set, DetailAST ident)
set
- the set of definitions.ident
- the specified method call IDENT ast.private static boolean isSimilarSignature(DetailAST ident, DetailAST ast)
ident
- the specified method call IDENT ast.ast
- the ast of a method definition to compare with.