io.sarl.lang.validation.subvalidators
Class SARLModifierValidator
class SARLModifierValidator
extends java.lang.Object
The modifier validator for constructs.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
compiler
Nested Type Summary
Modifier and type Type and description
interface SARLModifierValidator.ErrorRegisterer
Registerer of error.
interface SARLModifierValidator.IssueRegisterer
Registerer of issue (no specification of the type of issue).
Constructor Summary
Constructor and description
new(List<E>,List<E>,ErrorRegisterer,IssueRegisterer)
Constructor.
Action Summary
Modifier and type Action and description
protected void checkModifiers(XtendMember,String)
Check the modifiers for the given member.
protected void error(String,EObject,int)
Report an "invalid modifier" error through the associated validator.
protected boolean isPackageByDefault(XtendMember)
Replies if the default visibility modifier for the given member is "package".
protected boolean isPrivateByDefault(XtendMember)
Replies if the default visibility modifier for the given member is "private".
protected boolean isProtectedByDefault(XtendMember)
Replies if the default visibility modifier for the given member is "protected".
protected boolean isPublicByDefault(XtendMember)
Replies if the default visibility modifier for the given member is "public".
protected void issue(String,EObject,int,String,String*)
Report an issue through the associated validator.
void setDefaultVisibilityProvider(IDefaultVisibilityProvider)
Change the default visibility provider.
void setGrammarAccess(SARLGrammarKeywordAccess)
Change the grammar access.
protected void unnecessaryModifierIssue(String,String,EObject,int)
Report an issue for unnecessary modifier
Constructor Details
new(List<E>,List<E>,ErrorRegisterer,IssueRegisterer)
new(List<E>,List<E>,ErrorRegisterer,IssueRegisterer)
Constructor.
Parameters:
modifiers - the list of the supported modifiers.
visibilityModifiers - the list of the visibility modifiers defined in the compiler.
errorRegisterer - the callback for registering an error.
issueRegisterer - the callback for registering an issue without specifying if it is an error or a warning.
Action Details
checkModifiers(XtendMember,String)
protected def checkModifiers(XtendMember,String)
Check the modifiers for the given member.
Parameters:
member - the member to check.
memberName - the name of the member.
error(String,EObject,int)
protected def error(String,EObject,int)
Report an "invalid modifier" error through the associated validator.
Parameters:
message - the error message.
source - the source of the error.
index - the index of the element to which the error is attached.
isPackageByDefault(XtendMember)
protected def isPackageByDefault(XtendMember) : boolean
Replies if the default visibility modifier for the given member is "package". If this function replies true, the "package" modifier is assumed to be the default one for the given member. This function may be used for printing out an "unnecessary modifier" warning when the "package" modifier is explicitly attached to the given member.

This function is defined for being overridden by subclasses.
Parameters:
member - the member to test.
Returns:
true if the "package" modifier is the modifier by default for the given member.
isPrivateByDefault(XtendMember)
protected def isPrivateByDefault(XtendMember) : boolean
Replies if the default visibility modifier for the given member is "private". If this function replies true, the "private" modifier is assumed to be the default one for the given member. This function may be used for printing out an "unnecessary modifier" warning when the "private" modifier is explicitly attached to the given member.

This function is defined for being overridden by subclasses.
Parameters:
member - the member to test.
Returns:
true if the "private" modifier is the modifier by default for the given member.
isProtectedByDefault(XtendMember)
protected def isProtectedByDefault(XtendMember) : boolean
Replies if the default visibility modifier for the given member is "protected". If this function replies true, the "protected" modifier is assumed to be the default one for the given member. This function may be used for printing out an "unnecessary modifier" warning when the "protected" modifier is explicitly attached to the given member.

This function is defined for being overridden by subclasses.
Parameters:
member - the member to test.
Returns:
true if the "protected" modifier is the modifier by default for the given member.
isPublicByDefault(XtendMember)
protected def isPublicByDefault(XtendMember) : boolean
Replies if the default visibility modifier for the given member is "public". If this function replies true, the "public" modifier is assumed to be the default one for the given member. This function may be used for printing out an "unnecessary modifier" warning when the "public" modifier is explicitly attached to the given member.

This function is defined for being overridden by subclasses.
Parameters:
member - the member to test.
Returns:
true if the "public" modifier is the modifier by default for the given member.
issue(String,EObject,int,String,String*)
protected def issue(String,EObject,int,String,String*)
Report an issue through the associated validator.
Parameters:
message - the issue message.
source - the source of the issue.
index - the index of the element to which the issue is attached.
code - the code of the issue.
issueData - data associated to the issue.
setDefaultVisibilityProvider(IDefaultVisibilityProvider)
def setDefaultVisibilityProvider(IDefaultVisibilityProvider)
Change the default visibility provider.
Parameters:
provider - the provider of default visibility.
setGrammarAccess(SARLGrammarKeywordAccess)
def setGrammarAccess(SARLGrammarKeywordAccess)
Change the grammar access.
Parameters:
grammarAccess - the accessor.
unnecessaryModifierIssue(String,String,EObject,int)
protected def unnecessaryModifierIssue(String,String,EObject,int)
Report an issue for unnecessary modifier
Parameters:
modifier - the unnecessary modifier.
memberName - the name of the member to which the unnecessary modifier is attached.
source - the source of the issue.
index - the index of the element to which the issue is attached.