Interface ILcdAnnotatedElement

All Known Implementing Classes:
ALcdASDIModelDescriptor, ALcdMagneticNorthModelDescriptor, TLcdAIXM51ModelDescriptor, TLcdAreaMinimumAltitudeModelDescriptor, TLcdARINCMinimumSectorAltitudeModelDescriptor, TLcdARINCMORAModelDescriptor, TLcdASDIFlightPlanHistoryModelDescriptor, TLcdASDIFlightPlanModelDescriptor, TLcdASDITrackModelDescriptor, TLcdASDITrajectoryModelDescriptor, TLcdDAFIFMinimumSectorAltitudeModelDescriptor, TLcdDAFIFPrecisionApproachPathModelDescriptor, TLcdDatabaseModelDescriptor, TLcdDataModel, TLcdDataModelDescriptor, TLcdDataProperty, TLcdDataType, TLcdDB2SpatialModelDescriptor, TLcdFinalApproachPathModelDescriptor, TLcdGeoJsonModelDescriptor, TLcdGML2ModelDescriptor, TLcdGML31ModelDescriptor, TLcdGML32ModelDescriptor, TLcdGMLModelDescriptor, TLcdIGRFModelDescriptor, TLcdInformixGeodeticModelDescriptor, TLcdInformixSpatialModelDescriptor, TLcdKML22ModelDescriptor, TLcdMagneticNorthModelDescriptor, TLcdMinimumSectorAltitudeModelDescriptor, TLcdMSSQLModelDescriptor, TLcdNVG15ModelDescriptor, TLcdNVG20ModelDescriptor, TLcdNVGModelDescriptor, TLcdOracleSpatialModelDescriptor, TLcdPanoramaModelDescriptor, TLcdPostGISModelDescriptor, TLcdS57LevelModelDescriptor, TLcdSIGWXModelDescriptor, TLcdSpatiaLiteModelDescriptor, TLcdWFSProxyModelDescriptor, TLcdWMMModelDescriptor

public interface ILcdAnnotatedElement

An annotated element is an entity to which annotations can be attached. An annotation is an object of a class that implements ILcdAnnotation. For any given annotation class, there can be at most one annotation instance attached to an annotated element. As such, an annotated element serves as a map from annotation class to annotation instance.

A primary example of annotations is their usage in the LuciadLightspeed meta model. TLcdDataModel, TLcdDataType and TLcdDataProperty implement this interface. As such, custom meta data can be attached to instances of these classes. This makes the meta model extensible. A simple example of such custom meta data is the TLcdISO19103MeasureAnnotation. This annotation asserts that values of the properties to which it is added are of the ISO measure stored in the annotation.

Note that annotations are modeled similar to the way annotations have been added to Java classes (see also java.lang.annotation.Annotation). In contract with Java AnnotatedElement, ILcdAnnotatedElement supports the addition and removal of annotations.

Note that an annotated element is not guaranteed to be thread safe. It is up to the implementation to decide to support this or not.

Since:
10.0
  • Method Details

    • getAnnotation

      <T extends ILcdAnnotation> T getAnnotation(Class<T> aAnnotationClass)

      Returns the element's annotation for the specified class if such an annotation is present, else null.

      Note that the exact annotation class needs to be passed as parameter. In other words, in case the element is only annotated with instances of subclasses of the given annotation class, null is returned.

      Parameters:
      aAnnotationClass - - the Class object corresponding to the annotation type
      Returns:
      this element's annotation for the specified annotation class if present on this element, else null
    • isAnnotationPresent

      boolean isAnnotationPresent(Class<? extends ILcdAnnotation> aAnnotationClass)

      Returns true if an annotation for the specified class is present on this element, else false. This method is designed primarily for convenient access to marker annotations.

      Note that the exact annotation class needs to be passed as parameter. In other words, in case the element is only annotated with instances of subclasses of the given annotation class, false is returned.

      Parameters:
      aAnnotationClass - the Class object corresponding to the annotation class
      Returns:
      true if an annotation for the specified annotation class is present on this element, else false
    • getAnnotations

      Collection<ILcdAnnotation> getAnnotations()
      Returns all annotations present on this element as an unmodifiable collection.
      Returns:
      all annotations present on this element
    • addAnnotation

      <T extends ILcdAnnotation> T addAnnotation(ILcdAnnotation aAnnotation)
      Adds the given annotation to this element.
      Parameters:
      aAnnotation - the annotation to add
      Returns:
      the previous annotation of the same class as the given annotation associated with this element, or null if there was no annotation for that class.
    • removeAnnotation

      <T extends ILcdAnnotation> T removeAnnotation(Class<T> aAnnotationClass)

      Removes the annotation of the given class from this element.

      Note that the exact annotation class needs to be passed as parameter. In other words, in case the element is only annotated with instances of subclasses of the given annotation class, nothing is removed and null is returned.

      Parameters:
      aAnnotationClass - the class of annotation to remove
      Returns:
      the annotation of the given class that was associated with this element, or null if there was no annotation for that class.