public abstract class LintRule<E extends Element>
extends java.lang.Object
Lint rules are managed via ConfigAspectBase where they are registered during
construction time and automatically executed during the linting phase.
| Modifier | Constructor and Description |
|---|---|
protected |
LintRule(ConfigAspectBase aspect,
java.lang.String ruleName,
java.lang.Class<E> elemClass)
Constructs a lint rule applicable to the specified model element class.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Class<E> |
getElementClass()
Gets the element class this rule works on.
|
Location |
getLocationInConfig(com.google.protobuf.Message message,
java.lang.String fieldName)
Returns the service config file location of the given named field in the (sub)message.
|
java.lang.String |
getName()
Gets the name of the rule used in diagnosis.
|
abstract void |
run(E element)
Runs the rule.
|
protected void |
warning(java.lang.Object element,
java.lang.String message,
java.lang.Object... params)
Logs a lint warning.
|
protected LintRule(ConfigAspectBase aspect, java.lang.String ruleName, java.lang.Class<E> elemClass)
public java.lang.Class<E> getElementClass()
public java.lang.String getName()
public abstract void run(E element)
warning(Object, String, Object...) method.protected void warning(java.lang.Object element,
java.lang.String message,
java.lang.Object... params)
public Location getLocationInConfig(com.google.protobuf.Message message, java.lang.String fieldName)
SimpleLocation.TOPLEVEL if the location is not known.