public final class ExtendedMetaDataAnnotationValidator extends BasicEAnnotationValidator
ExtendedMetadata annotations.BasicEAnnotationValidator.Assistant, BasicEAnnotationValidator.ValidationContextEAnnotationValidator.Descriptor, EAnnotationValidator.Registry| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DIAGNOSTIC_SOURCE |
static int |
IGNORED_ENTRY |
static ExtendedMetaDataAnnotationValidator |
INSTANCE |
static int |
INVALID_VALUE_LITERAL |
annotationName, annotationSource, assistant, diagnosticSource, IGNORED_ANNOTATIONS, IGNORED_CONTENTS, IGNORED_REFERENCES, INVALID_ANNOTATION, INVALID_CONTENT, INVALID_DETAIL_VALUE, INVALID_DUPLICATE, INVALID_LOCATION, INVALID_REFERENCE, INVALID_REFERENCE_LITERAL, MISSING_ENTRY, MISSING_REQUIRED_ENTRY_VALUE, TOO_FEW_VALUES, TOO_MANY_VALUES| Constructor and Description |
|---|
ExtendedMetaDataAnnotationValidator() |
| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<?> |
filterChoiceOfValues(EObject eObject,
EStructuralFeature eStructuralFeature,
java.util.Collection<?> choiceOfValues) |
protected java.util.List<EClass> |
getPropertyClasses(EModelElement eModelElement)
Returns the model classes used to represent annotations for the given model element.
|
protected ResourceLocator |
getResourceLocator()
Returns the resource locator for fetching implementation-specific messages.
|
protected EObject |
initialize(EObject eObject,
EAnnotation eAnnotation)
Returns an initialized instance of the given object for the given annotation.
|
protected boolean |
isApplicable(EObject eObject,
EStructuralFeature eStructuralFeature)
Returns whether the given feature of the given modeled representation is meaningful for the current state of the model.
|
protected boolean |
isValidLocation(EAnnotation eAnnotation,
EModelElement eModelElement)
Returns whether this annotation
contained by this model element is valid at this location. |
protected boolean |
validateDetails(EAnnotation eAnnotation,
EModelElement eModelElement,
DiagnosticChain diagnostics,
java.util.Map<java.lang.Object,java.lang.Object> context)
Returns whether this annotation's
details are valid. |
protected boolean |
validateFeatureDetail(EAnnotation eAnnotation,
EModelElement eModelElement,
java.util.Map.Entry<java.lang.String,java.lang.String> entry,
EStructuralFeature feature,
DiagnosticChain diagnostics,
java.util.Map<java.lang.Object,java.lang.Object> context)
Returns whether the value of this detail entry for the corresponding feature is valid.
|
protected boolean |
validateFeatureDetailValue(EAnnotation eAnnotation,
EModelElement eModelElement,
java.util.Map.Entry<java.lang.String,java.lang.String> entry,
EStructuralFeature feature,
java.util.List<java.lang.Object> values,
DiagnosticChain diagnostics,
java.util.Map<java.lang.Object,java.lang.Object> context)
Returns whether the modeled values for this detail entry's corresponding feature are valid.
|
protected boolean |
validateReferenceDetailValueLiteral(EAnnotation eAnnotation,
EModelElement eModelElement,
java.util.Map.Entry<java.lang.String,java.lang.String> entry,
EReference reference,
java.lang.String literalValue,
java.util.List<java.lang.Object> referenceValues,
DiagnosticChain diagnostics,
java.util.Map<java.lang.Object,java.lang.Object> context)
Returns whether the given literal value is valid with respect to this detail entry's corresponding reference's
class. |
convertPropertyAttributeValueToLiteralItem, convertPropertyReferenceValueToLiteralItem, convertPropertyValueToLiteral, convertPropertyValueToLiteralItem, createAssistant, createDiagnostic, createInstance, createValueDiagnostic, getAllValidAnnotations, getAnnotationSource, getAssistant, getEcoreResourceLocator, getProperties, getRootEValidator, getString, getValidAnnotations, getValidContents, getValidLocationDescription, getValidReferences, isAnnotationsSupported, isContentsSupported, isDuplicateValid, isIncludedProperty, isReferencesSupported, isValidLocation, join, loadEPackage, reportDuplicate, reportIgnoredAnnotations, reportIgnoredContents, reportIgnoredEntry, reportIgnoredReferences, reportInvalidAnnotation, reportInvalidContent, reportInvalidLocation, reportInvalidReference, reportInvalidReferenceLiteral, reportInvalidValueLiteral, reportMissingEntry, reportMissingRequiredEntryValue, reportTooFewValues, reportTooManyValues, split, validate, validateAnnotations, validateAttributeDetailLiteralValue, validateAttributeDetailValueLiteral, validateContents, validateDetail, validateReferenceDetailLiteralValue, validateReferencespublic static final ExtendedMetaDataAnnotationValidator INSTANCE
public static final java.lang.String DIAGNOSTIC_SOURCE
public static final int INVALID_VALUE_LITERAL
SpecializedExtendedMetaData#reportBadValue(Object, DiagnosticChain, int, String, Object...),
Constant Field Valuespublic static final int IGNORED_ENTRY
SpecializedExtendedMetaData#reportIgnoredEntry(Map.Entry, DiagnosticChain, String, Object...),
Constant Field Valuesprotected ResourceLocator getResourceLocator()
BasicEAnnotationValidatorgetResourceLocator in class BasicEAnnotationValidatorprotected EObject initialize(EObject eObject, EAnnotation eAnnotation)
BasicEAnnotationValidator
This implementation handles only the case of modeled attributes.
For each detail entry,
it looks up the corresponding property via the key.
If it's not an EAttribute it will throw an UnsupportedOperationException.
If the attribute property is multi-valued,
it splits the detail entry value, and converts each literal item into a value of the attribute's data type.
If it's single-valued, the literal value is directly converted to the attributes data type.
The resulting list value or single value is reflectively set into the instance.
If the model representation includes references,
an annotation validator implementation must specialize this method for the assistant to function correctly.
initialize in class BasicEAnnotationValidatoreObject - the object to initialize.eAnnotation - the annotation used to initialize the object.protected boolean isApplicable(EObject eObject, EStructuralFeature eStructuralFeature)
BasicEAnnotationValidator
This method is used to induce the applicable properties by the assistant.
It is not directly used by the annotation validator itself.
This implementation always returns true.
isApplicable in class BasicEAnnotationValidatoreObject - the modeled object in question.eStructuralFeature - a feature of that object.protected boolean isValidLocation(EAnnotation eAnnotation, EModelElement eModelElement)
BasicEAnnotationValidatorcontained by this model element is valid at this location.
This implementation returns false if the element is not a named element.
It's typically the case that annotations on annotations aren't meaningful and valid.
isValidLocation in class BasicEAnnotationValidatoreAnnotation - the annotation in question.eModelElement - the annotation's containing model element.BasicEAnnotationValidator.isValidLocation(EAnnotation),
BasicEAnnotationValidator.validate(EAnnotation, DiagnosticChain, Map)protected java.util.List<EClass> getPropertyClasses(EModelElement eModelElement)
BasicEAnnotationValidator
Typically an annotation validator implementation will return a single class.
An induced user interface will generally require the ability to create instances of the classes returned by this method.
The annotation validator implementation itself does not require that ability.
getPropertyClasses in class BasicEAnnotationValidatoreModelElement - the model element in question.protected boolean validateDetails(EAnnotation eAnnotation, EModelElement eModelElement, DiagnosticChain diagnostics, java.util.Map<java.lang.Object,java.lang.Object> context)
BasicEAnnotationValidatordetails are valid.
This implementation uses the properties of the model element.
For each detail, it determines whether there is a corresponding feature in the properties.
If not, it validates the detail without a property feature.
If so, it validates the detail with the property feature.
If all the details are valid,
it will check whether any required property feature is absent from the details
and reports it missing.
validateDetails in class BasicEAnnotationValidatoreAnnotation - the annotation in question.eModelElement - the annotation's containing model element.diagnostics - a place to accumulate diagnostics; if it's null, no diagnostics should be produced.context - a place to cache information, if it's null, no cache is supported.protected boolean validateFeatureDetail(EAnnotation eAnnotation, EModelElement eModelElement, java.util.Map.Entry<java.lang.String,java.lang.String> entry, EStructuralFeature feature, DiagnosticChain diagnostics, java.util.Map<java.lang.Object,java.lang.Object> context)
BasicEAnnotationValidator
This implementation delegates
to validateAttributeDetail
or to validateReferenceDetail
depending on whether the feature is an EAttribute or an EReference.
It creates a place holder diagnostic that it passed to those methods,
so all diagnostics gathered by those methods are grouped as children of the placeholder.
Both those methods build the corresponding modeled values as a side-effect.
If the detail entry is otherwise valid,
the modeled value is validated.
validateFeatureDetail in class BasicEAnnotationValidatoreAnnotation - the annotation in question.eModelElement - the annotation's containing model element.entry - the annotation detail in question.feature - the property associated with entry.diagnostics - a place to accumulate diagnostics; if it's null, no diagnostics should be produced.context - a place to cache information, if it's null, no cache is supported.protected boolean validateReferenceDetailValueLiteral(EAnnotation eAnnotation, EModelElement eModelElement, java.util.Map.Entry<java.lang.String,java.lang.String> entry, EReference reference, java.lang.String literalValue, java.util.List<java.lang.Object> referenceValues, DiagnosticChain diagnostics, java.util.Map<java.lang.Object,java.lang.Object> context)
BasicEAnnotationValidatorclass.
As a side-effect, if the literal value can be converted to an instance value, the corresponding instance value is added to the list of reference values.
This implementation always returns false and reports an invalid reference literal.
An annotation validator implementation that supports reference literals must specialize this method.
validateReferenceDetailValueLiteral in class BasicEAnnotationValidatoreAnnotation - the annotation in question.eModelElement - the annotation's containing model element.entry - the annotation detail in question.reference - the reference property associated with entry.literalValue - the literal value of the class.referenceValues - the list in which to accumulate valid instance values.diagnostics - a place to accumulate diagnostics; if it's null, no diagnostics should be produced.context - a place to cache information, if it's null, no cache is supported.protected boolean validateFeatureDetailValue(EAnnotation eAnnotation, EModelElement eModelElement, java.util.Map.Entry<java.lang.String,java.lang.String> entry, EStructuralFeature feature, java.util.List<java.lang.Object> values, DiagnosticChain diagnostics, java.util.Map<java.lang.Object,java.lang.Object> context)
BasicEAnnotationValidator
For a many-valued feature, it validates that the lower and upper bounds are respected.
For a singled valued feature that is required, it validates that the value is present;
in the single-valued case, the values list should contain a single value.
validateFeatureDetailValue in class BasicEAnnotationValidatoreAnnotation - the annotation in question.eModelElement - the annotation's containing model element.entry - the annotation detail in question.feature - the property associated with entry.values - the list of instance values for this entry.diagnostics - a place to accumulate diagnostics; if it's null, no diagnostics should be produced.context - a place to cache information, if it's null, no cache is supported.public java.util.Collection<?> filterChoiceOfValues(EObject eObject, EStructuralFeature eStructuralFeature, java.util.Collection<?> choiceOfValues)
Copyright © 2018. Licensed under the Eclipse Public License v1.0. All rights reserved.
Submit a bug or feature