Interface AnnotationTargetParentProvider


@OpenApiAll public interface AnnotationTargetParentProvider
When retrieving annotations by a target object in AnnotationManager, annotations of parent targets are also included (recursively). Implementations of this interface can define what is the parent target for some target object. Each implementation has to be registered by calling AnnotationManager.addAnnotationParentTargetProvider(AnnotationTargetParentProvider).

Example: if AnnotationManager.getAnnotations(java.lang.Object) is called for for a ClassView symbol then annotations whose Annotation.getTargetObject() is the symbol's Class element will also be included.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accept(Object target)
     
    void
    cleanup(Project closedProject)
    Called after project is closed to clean any project specific caches
    getParent(Object target)
    This method is called each time annotations are requested for any target in AnnotationManager and that happens constantly.
    Project for the custom target is required to clean up the added annotations when the project is closed
  • Method Details

    • accept

      boolean accept(Object target)
    • getParent

      @CheckForNull Object getParent(Object target)
      This method is called each time annotations are requested for any target in AnnotationManager and that happens constantly. So implementations of this method should be fast and avoid new object creation.

      It is legal to return the same instance of the parent object for different targets. In fact, core implementations does this - uses the same instance but uses setters to change the object for each call. For that reason the returned parent objects are not and should not be cached/stored. They are only for momentary use and are in a thread safe manner used as key to retrieve annotations from a HashSet.
      Parameters:
      target - annotation target
    • getProject

      @CheckForNull Project getProject(Object target)
      Project for the custom target is required to clean up the added annotations when the project is closed
    • cleanup

      void cleanup(Project closedProject)
      Called after project is closed to clean any project specific caches