Class BasicAnnotationValidator.Assistant

java.lang.Object
org.eclipse.emf.cdo.etypes.util.BasicAnnotationValidator.Assistant
Enclosing class:
BasicAnnotationValidator

public abstract static class BasicAnnotationValidator.Assistant extends Object
An assistant that is useful for inducing a user interface that represents the annotation information in a more structured way using modeled objects that are created by createInstance(EClass, Annotation). This implementation delegates to the annotation validator which in turn provides an accessor for its to corresponding assistant. This class generally does not need to be specialized nor instantiated because every annotation validator provides an assistant. This class therefore is abstract though none of its methods are abstract.
  • Field Details

    • annotationValidator

      protected final BasicAnnotationValidator annotationValidator
      The annotation validator to which this assistant delegates.
  • Constructor Details

    • Assistant

      public Assistant(BasicAnnotationValidator annotationValidator)
      Creates an instance that delegates to the give annotation validator.
  • Method Details

    • isValidLocation

      public boolean isValidLocation(Annotation annotation)
      Returns whether this annotation with this annotation validator's annotation source is valid at its current location.

      The implementation delegates to BasicAnnotationValidator.isValidLocation(Annotation). An induced user interface can use this to determine if it can/should use this assistant's information for representing modeled annotation information.

      Parameters:
      annotation - the annotation in question.
      Returns:
      whether this annotation with this annotation validator's annotation source is valid at its current location.
    • getProperties

      public Map<String,EStructuralFeature> getProperties(ModelElement modelElement)
      Returns a map from key to feature. These represents the keys that are considered valid and can be processed by this annotation validator.

      The implementation delegates to BasicAnnotationValidator.getProperties(ModelElement). An induced user interface can use this method to determine which properties to display.

      Parameters:
      modelElement - the model element that is being annotated.
      Returns:
      a map from key to feature.
      See Also:
    • getPropertyClasses

      public List<EClass> getPropertyClasses(ModelElement modelElement)
      Returns the model classes used to represent annotations for the given model element.

      The implementation delegates to BasicAnnotationValidator.getPropertyClasses(ModelElement). An induced user interface can use this method to determine which instances to create for display purposes.

      Parameters:
      modelElement - the model element in question.
      Returns:
      the model classes used to represent annotations for the given model element.
    • createInstance

      public EObject createInstance(EClass eClass, Annotation annotation)
      Creates an initialized instance of the modeled representation for the given annotation.

      The implementation delegates to BasicAnnotationValidator.createInstance(EClass, Annotation). An induced user interface can use this method to create instances for display purposes.

      Parameters:
      eClass - the class to be instantiated.
      annotation - the annotation with the information that needs to be represented.
      Returns:
      creates an initialized instance of the modeled representation for the given annotation.
    • convertPropertyValueToLiteral

      public String convertPropertyValueToLiteral(EObject eObject, EStructuralFeature eStructuralFeature, Object value)
    • getApplicableProperties

      public Map<String,EStructuralFeature> getApplicableProperties(EObject eObject, Annotation annotation)
      Returns the subset of properties that are applicable for the current state of the modeled annotation instance.

      This subset includes only those properties of the annotation's containing model element for which BasicAnnotationValidator.isApplicable(EObject, EStructuralFeature) returns true. An induced user interface should avoid displaying properties that are not applicable for the current state of the modeled annotation instance.

      Parameters:
      eObject - the modeled instance in question.
      annotation - the corresponding annotation of that modeled instance.
      Returns:
      the subset of properties that are applicable for the current state of the modeled annotation instance.
    • isReferencesSupported

      public boolean isReferencesSupported(Annotation annotation)
      Returns whether references are meaningful for this annotation.

      The implementation delegates to BasicAnnotationValidator.isReferencesSupported(Annotation, ModelElement), passing in the containing model element. An induced user interface should avoid providing the ability to specify references when this returns false.

      Parameters:
      annotation - the annotation in question.
      Returns:
      whether references are meaningful for this annotation.
    • getValidReferences

      public Collection<?> getValidReferences(Annotation annotation, Collection<?> references)
      Returns the filtered collection of references that are valid for this annotation.

      The implementation delegates to BasicAnnotationValidator.getValidReferences(Annotation, ModelElement, Collection), passing in the containing model element. An induced user interface should provide the ability to specify only the references returned by this method. The references argument may contain all reachable objects, some subset there of, or none at all; an implementation may choose to filter from this collection or to provide its own result, including objects not in this collection.

      Parameters:
      annotation - the annotation in question.
      references - all reachable objects, some subset there of, or none at all.
      Returns:
      the objects that are valid as references for this annotation.
    • isContentsSupported

      public boolean isContentsSupported(Annotation annotation)
      Returns whether contents are meaningful for this annotation.

      The implementation delegates to BasicAnnotationValidator.isContentsSupported(Annotation, ModelElement), passing in the containing model element and an empty list. An induced user interface should avoid providing the ability to specify contents when this returns false.

      Parameters:
      annotation - the annotation in question.
      Returns:
      whether contents are meaningful for this annotation.
    • getValidContents

      public Collection<? extends EObject> getValidContents(Annotation annotation, Collection<? extends EObject> contents)
      Returns the filtered collection of contents that are valid for this annotation.

      The implementation delegates to BasicAnnotationValidator.getValidContents(Annotation, ModelElement, Collection) passing in the containing model element. An induced user interface should provide the ability to specify only the contents returned by this method.

      Parameters:
      annotation - the annotation in question.
      contents - nothing at all, or the potential contents of the annotation.
      Returns:
      the objects that are valid as contents for this annotation.
    • isAnnotationsSupported

      public boolean isAnnotationsSupported(Annotation annotation)
      Returns whether nested annotations are meaningful for this annotation.

      The implementation delegates to BasicAnnotationValidator.isAnnotationsSupported(Annotation, ModelElement), passing in the containing model element. An induced user interface should avoid providing the ability to specify nested annotations when this returns false.

      Parameters:
      annotation - the annotation in question.
      Returns:
      whether annotations are meaningful for this annotation.
    • getValidAnnotations

      public Collection<? extends Annotation> getValidAnnotations(Annotation annotation, Collection<? extends Annotation> annotations)
      Returns the filtered collection of nested annotations that are valid for this annotation.

      The implementation delegates to BasicAnnotationValidator.getAllValidAnnotations(Annotation, ModelElement, Collection) passing in the containing model element. An induced user interface should provide the ability to specify only the nested annotations returned by this method.

      Parameters:
      annotation - the annotation in question.
      annotations - nothing at all, or the current or potential nested annotations of the annotation.
      Returns:
      the annotations that are valid as nested annotations for this annotation.