public abstract class ConfigAspectBase extends java.lang.Object implements ConfigAspect
All aspect implementations must extend this class or it's descendants instead of directly
implementing the interface ConfigAspect. Errors and warnings must be reported using the
methods on this class instead of via the model.
Please observe that according to rules described in ConfigAspect, during the merging
state, only essential validation issues should be reported as errors, but not style violations.
It is recommended to use the LintRule mechanism for style violations.
| Modifier | Constructor and Description |
|---|---|
protected |
ConfigAspectBase(Model model,
java.lang.String aspectName)
Initializes this base class.
|
| Modifier and Type | Method and Description |
|---|---|
DiagCollector |
asDiagCollector()
Return a view of this aspect as a diag collector.
|
void |
endLinting()
Default implementation ending linting.
|
void |
endMerging()
Default implementation ending merging; does nothing.
|
void |
endNormalization(com.google.api.Service.Builder builder)
Default implementation of ending normalization; does nothing.
|
void |
error(java.lang.Object elementOrLocation,
java.lang.String message,
java.lang.Object... params)
Helper for subclasses to report an error.
|
java.lang.String |
getAspectName()
Returns the string identifying the aspect in diagnosis.
|
java.lang.String |
getDocumentation(ProtoElement element)
Default implementation of aspect documentation.
|
java.lang.String |
getDocumentationTitle(ProtoElement element)
Default implementation of aspect documentation title.
|
java.util.Set<java.lang.String> |
getLintRuleNames()
Returns the set of all style rule names related to this aspect.
|
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.
|
Location |
getLocationOfRepeatedFieldInConfig(com.google.protobuf.Message message,
java.lang.String fieldName,
java.lang.Object elementKey)
Returns the service config file location of the given named field in the (sub)message.
|
Model |
getModel()
Returns the model to which the aspect is linked.
|
void |
lint(ProtoElement elem)
Default implementation of linting an element.
|
void |
lintWarning(java.lang.String ruleName,
java.lang.Object elementOrLocation,
java.lang.String message,
java.lang.Object... params)
Helper for subclasses to report a linter warning.
|
void |
merge(ProtoElement elem)
Default implementation for merging an element; does nothing.
|
void |
normalize(ProtoElement element,
com.google.api.Service.Builder builder)
Default implementation to normalize an element; does nothing.
|
<E extends Element> |
registerLintRule(LintRule<E> rule)
Registers a linting rule with this aspect.
|
void |
registerLintRuleName(java.lang.String... names)
Registers name of a lint rule.
|
void |
startLinting()
Default implementation of start linting; does nothing.
|
void |
startMerging()
Default implementation of starting merge; does nothing.
|
void |
startNormalization(com.google.api.Service.Builder builder)
Default implementation of starting normalization; does nothing.
|
void |
warning(java.lang.Object elementOrLocation,
java.lang.String message,
java.lang.Object... params)
Helper for subclasses to report a warning.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmergeDependenciesprotected ConfigAspectBase(Model model, java.lang.String aspectName)
public Model getModel()
public java.lang.String getAspectName()
ConfigAspectgetAspectName in interface ConfigAspectpublic java.util.Set<java.lang.String> getLintRuleNames()
ConfigAspectgetLintRuleNames in interface ConfigAspectpublic <E extends Element> void registerLintRule(LintRule<E> rule)
public void registerLintRuleName(java.lang.String... names)
lintWarning(String, Object, String, Object...) to enable suppression. Does not need to
be used for rules using the registerLintRule(LintRule) mechanism.public void startMerging()
startMerging in interface ConfigAspectpublic void merge(ProtoElement elem)
merge in interface ConfigAspectpublic void endMerging()
endMerging in interface ConfigAspectpublic void startLinting()
startLinting in interface ConfigAspectpublic void lint(ProtoElement elem)
If you override this method, be sure to call super.
lint in interface ConfigAspectpublic void endLinting()
If you override this method, be sure to call super.
endLinting in interface ConfigAspectpublic void startNormalization(com.google.api.Service.Builder builder)
startNormalization in interface ConfigAspectpublic void normalize(ProtoElement element, com.google.api.Service.Builder builder)
normalize in interface ConfigAspectpublic void endNormalization(com.google.api.Service.Builder builder)
endNormalization in interface ConfigAspectpublic java.lang.String getDocumentationTitle(ProtoElement element)
getDocumentationTitle in interface ConfigAspectpublic java.lang.String getDocumentation(ProtoElement element)
getDocumentation in interface ConfigAspectpublic void error(java.lang.Object elementOrLocation,
java.lang.String message,
java.lang.Object... params)
public void warning(java.lang.Object elementOrLocation,
java.lang.String message,
java.lang.Object... params)
public void lintWarning(java.lang.String ruleName,
java.lang.Object elementOrLocation,
java.lang.String message,
java.lang.Object... params)
This method should usually not be directly called. Instead, use the LintRule
mechanism.
public Location getLocationInConfig(com.google.protobuf.Message message, java.lang.String fieldName)
public Location getLocationOfRepeatedFieldInConfig(com.google.protobuf.Message message, java.lang.String fieldName, java.lang.Object elementKey)
SimpleLocation.TOPLEVEL if the location is not known.public DiagCollector asDiagCollector()