Package com.nomagic.magicdraw.annotation
Interface AnnotationTargetParentProvider
-
@OpenApiAll public interface AnnotationTargetParentProvider
When retrieving annotations by a target object inAnnotationManager
, 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 callingAnnotationManager.addAnnotationParentTargetProvider(AnnotationTargetParentProvider)
.
Example: ifAnnotationManager.getAnnotations(java.lang.Object)
is called for for aClassView
symbol then annotations whoseAnnotation.getTargetObject()
is the symbol'sClass
element will also be included.- See Also:
AnnotationManager
,Annotation
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
accept(java.lang.Object target)
void
cleanup(Project closedProject)
Called after project is closed to clean any project specific cachesjava.lang.Object
getParent(java.lang.Object target)
This method is called each time annotations are requested for any target inAnnotationManager
and that happens constantly.Project
getProject(java.lang.Object target)
Project for the custom target is required to clean up the added annotations when the project is closed
-
-
-
Method Detail
-
accept
boolean accept(java.lang.Object target)
-
getParent
@CheckForNull java.lang.Object getParent(java.lang.Object target)
This method is called each time annotations are requested for any target inAnnotationManager
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 aHashSet
.- Parameters:
target
- annotation target
-
getProject
@CheckForNull Project getProject(java.lang.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
-
-