Package org.hibernate.models.internal
Interface AnnotationTargetSupport
- All Superinterfaces:
AnnotationTarget,MutableAnnotationTarget
- All Known Subinterfaces:
ClassDetailsSupport
- All Known Implementing Classes:
AbstractAnnotationDescriptor,AbstractAnnotationTarget,AbstractAnnotationTarget,AbstractJdkAnnotationTarget,DynamicClassDetails,DynamicFieldDetails,JdkClassDetails,JdkFieldDetails,JdkMethodDetails,JdkRecordComponentDetails,OrmAnnotationDescriptor,StandardAnnotationDescriptor
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hibernate.models.spi.AnnotationTarget
AnnotationTarget.AnnotationUsageProcessor<T,A extends Annotation>, AnnotationTarget.Kind -
Method Summary
Modifier and TypeMethodDescriptiondefault <X extends Annotation>
voidaddAnnotationUsage(X annotationUsage) Add an annotation usage to this targetdefault <A extends Annotation>
AnnotationDescriptor<A> Safe cast method for cases when the target is an annotation.Safe cast method for cases when the target is a record component.default voidRemoves all annotation usages currently associated with this target.default <A extends Annotation,C extends Annotation>
voidforEachRepeatedAnnotationUsages(Class<A> repeatableType, Class<C> containerType, ModelsContext modelContext, Consumer<A> consumer) default <A extends Annotation,C extends Annotation>
voidforEachRepeatedAnnotationUsages(AnnotationDescriptor<A> repeatableDescriptor, ModelsContext modelContext, Consumer<A> consumer) default <A extends Annotation>
AgetAnnotationUsage(Class<A> annotationType, ModelsContext modelContext) Form ofAnnotationTarget.getAnnotationUsage(AnnotationDescriptor, ModelsContext)accepting the annotation Classdefault <A extends Annotation>
AgetAnnotationUsage(AnnotationDescriptor<A> descriptor, ModelsContext modelContext) Get the usage of the given annotation on this target.default <A extends Annotation>
AgetDirectAnnotationUsage(Class<A> type) Form ofAnnotationTarget.getDirectAnnotationUsage(AnnotationDescriptor)accepting the annotation Classdefault <A extends Annotation>
AgetDirectAnnotationUsage(AnnotationDescriptor<A> descriptor) Form of AnnotationTarget.getAnnotationUsage(AnnotationDescriptor, ModelsContext) which returnsnullinstead of throwing AnnotationAccessException when more than one usage of the requested annotation exists.default Collection<? extends Annotation> Access to all the annotations used on this target.default <A extends Annotation>
List<? extends Annotation> getMetaAnnotated(Class<A> metaAnnotationType, ModelsContext modelContext) Returns all Annotation usages from this target where the usage's annotation class is annotated with the givenmetaAnnotationType.default <X extends Annotation>
XgetNamedAnnotationUsage(Class<X> type, String matchName, String attributeToMatch, ModelsContext modelContext) default <X extends Annotation>
XgetNamedAnnotationUsage(Class<X> type, String matchName, ModelsContext modelContext) default <X extends Annotation>
XgetNamedAnnotationUsage(AnnotationDescriptor<X> type, String matchName, String attributeToMatch, ModelsContext modelContext) Get a usage of the given annotationtypewhoseattributeToMatchattribute value matches the givenmatchName.default <A extends Annotation>
A[]getRepeatedAnnotationUsages(AnnotationDescriptor<A> type, ModelsContext modelContext) Get all usages of the specifiedannotationTypein this scope.Map<Class<? extends Annotation>, ? extends Annotation> Access to all annotation usages on this target.default <X extends Annotation>
booleanhasAnnotationUsage(Class<X> type, ModelsContext modelContext) Whether the given annotation is used on this target.default <A extends Annotation>
booleanhasDirectAnnotationUsage(Class<A> type) Whether the given annotation is used on this target.default <A extends Annotation>
AlocateAnnotationUsage(Class<A> annotationType, ModelsContext modelContext) Form of AnnotationTarget.getAnnotationUsage(org.hibernate.models.spi.AnnotationDescriptor<A>, org.hibernate.models.spi.ModelsContext) which also considers meta-annotations - annotations on the classes of each local annotation.default <X extends Annotation>
voidremoveAnnotationUsage(AnnotationDescriptor<X> annotationType) Remove an annotation, by type, from this target if there is such a usage.default <S extends Annotation,P extends Annotation>
PreplaceAnnotationUsage(AnnotationDescriptor<S> repeatableType, AnnotationDescriptor<P> containerType, ModelsContext modelContext) Creates and replaces (if any) an existing usage of the given annotation.Methods inherited from interface org.hibernate.models.spi.AnnotationTarget
forEachAnnotationUsage, forEachAnnotationUsage, forEachDirectAnnotationUsage, fromAnnotations, fromContainers, fromSelfAndContainers, getContainer, getKind, getName, getNamedAnnotationUsage, getRepeatedAnnotationUsages, walkContainers, walkSelfAndContainersMethods inherited from interface org.hibernate.models.spi.MutableAnnotationTarget
applyAnnotationUsage, replaceAnnotationUsage
-
Method Details
-
getUsageMap
Map<Class<? extends Annotation>,? extends Annotation> getUsageMap()Access to all annotation usages on this target. -
clearAnnotationUsages
default void clearAnnotationUsages()Description copied from interface:MutableAnnotationTargetRemoves all annotation usages currently associated with this target. Useful for complete XML mappings.- Specified by:
clearAnnotationUsagesin interfaceMutableAnnotationTarget
-
addAnnotationUsage
Description copied from interface:MutableAnnotationTargetAdd an annotation usage to this target- Specified by:
addAnnotationUsagein interfaceMutableAnnotationTarget
-
removeAnnotationUsage
Description copied from interface:MutableAnnotationTargetRemove an annotation, by type, from this target if there is such a usage.- Specified by:
removeAnnotationUsagein interfaceMutableAnnotationTarget
-
getDirectAnnotationUsages
Description copied from interface:AnnotationTargetAccess to all the annotations used on this target.- Specified by:
getDirectAnnotationUsagesin interfaceAnnotationTarget
-
getDirectAnnotationUsage
Description copied from interface:AnnotationTargetForm of AnnotationTarget.getAnnotationUsage(AnnotationDescriptor, ModelsContext) which returnsnullinstead of throwing AnnotationAccessException when more than one usage of the requested annotation exists.- Specified by:
getDirectAnnotationUsagein interfaceAnnotationTarget
-
getDirectAnnotationUsage
Description copied from interface:AnnotationTargetForm ofAnnotationTarget.getDirectAnnotationUsage(AnnotationDescriptor)accepting the annotation Class- Specified by:
getDirectAnnotationUsagein interfaceAnnotationTarget
-
hasDirectAnnotationUsage
Description copied from interface:AnnotationTargetWhether the given annotation is used on this target.- Specified by:
hasDirectAnnotationUsagein interfaceAnnotationTarget- See Also:
-
hasAnnotationUsage
default <X extends Annotation> boolean hasAnnotationUsage(Class<X> type, ModelsContext modelContext) Description copied from interface:AnnotationTargetWhether the given annotation is used on this target.- Specified by:
hasAnnotationUsagein interfaceAnnotationTarget- See Also:
-
getAnnotationUsage
default <A extends Annotation> A getAnnotationUsage(AnnotationDescriptor<A> descriptor, ModelsContext modelContext) Description copied from interface:AnnotationTargetGet the usage of the given annotation on this target. For repeatable annotation types (e.g.@NamedQuery), this method will either-- if a single repeatable annotation itself is present, it is returned.
-
if the "containing annotation" is present (e.g.
@NamedQueries),- if the container contains just a single repeatable, that one is returned
-
if the container contains multiple repeatables,
AnnotationAccessExceptionwill be thrown
- Specified by:
getAnnotationUsagein interfaceAnnotationTarget- Returns:
- The usage or
null
-
getAnnotationUsage
default <A extends Annotation> A getAnnotationUsage(Class<A> annotationType, ModelsContext modelContext) Description copied from interface:AnnotationTargetForm ofAnnotationTarget.getAnnotationUsage(AnnotationDescriptor, ModelsContext)accepting the annotation Class- Specified by:
getAnnotationUsagein interfaceAnnotationTarget
-
getRepeatedAnnotationUsages
default <A extends Annotation> A[] getRepeatedAnnotationUsages(AnnotationDescriptor<A> type, ModelsContext modelContext) Description copied from interface:AnnotationTargetGet all usages of the specifiedannotationTypein this scope.- Specified by:
getRepeatedAnnotationUsagesin interfaceAnnotationTarget
-
forEachRepeatedAnnotationUsages
default <A extends Annotation,C extends Annotation> void forEachRepeatedAnnotationUsages(Class<A> repeatableType, Class<C> containerType, ModelsContext modelContext, Consumer<A> consumer) - Specified by:
forEachRepeatedAnnotationUsagesin interfaceAnnotationTarget
-
forEachRepeatedAnnotationUsages
default <A extends Annotation,C extends Annotation> void forEachRepeatedAnnotationUsages(AnnotationDescriptor<A> repeatableDescriptor, ModelsContext modelContext, Consumer<A> consumer) - Specified by:
forEachRepeatedAnnotationUsagesin interfaceAnnotationTarget
-
locateAnnotationUsage
default <A extends Annotation> A locateAnnotationUsage(Class<A> annotationType, ModelsContext modelContext) Description copied from interface:AnnotationTargetForm of AnnotationTarget.getAnnotationUsage(org.hibernate.models.spi.AnnotationDescriptor<A>, org.hibernate.models.spi.ModelsContext) which also considers meta-annotations - annotations on the classes of each local annotation.- Specified by:
locateAnnotationUsagein interfaceAnnotationTarget
-
getMetaAnnotated
default <A extends Annotation> List<? extends Annotation> getMetaAnnotated(Class<A> metaAnnotationType, ModelsContext modelContext) Description copied from interface:AnnotationTargetReturns all Annotation usages from this target where the usage's annotation class is annotated with the givenmetaAnnotationType. E.g., given the following class and annotationsa call to this method passing@interface TheMeta{ ... }@TheMeta(...)@interface TheAnnotation{ ... }@TheAnnotationclass TheClass{ ... }TheMetaonClassDetails(TheClass)will return the usage of@TheAnnotationonTheClass.- Specified by:
getMetaAnnotatedin interfaceAnnotationTarget
-
getNamedAnnotationUsage
default <X extends Annotation> X getNamedAnnotationUsage(Class<X> type, String matchName, ModelsContext modelContext) Description copied from interface:AnnotationTargetHelper form of AnnotationTarget.getNamedAnnotationUsage(AnnotationDescriptor, String, ModelsContext)- Specified by:
getNamedAnnotationUsagein interfaceAnnotationTarget
-
getNamedAnnotationUsage
default <X extends Annotation> X getNamedAnnotationUsage(AnnotationDescriptor<X> type, String matchName, String attributeToMatch, ModelsContext modelContext) Description copied from interface:AnnotationTargetGet a usage of the given annotationtypewhoseattributeToMatchattribute value matches the givenmatchName.- Specified by:
getNamedAnnotationUsagein interfaceAnnotationTarget- Parameters:
matchName- The name to match.attributeToMatch- Name of the attribute to match on.
-
getNamedAnnotationUsage
default <X extends Annotation> X getNamedAnnotationUsage(Class<X> type, String matchName, String attributeToMatch, ModelsContext modelContext) Description copied from interface:AnnotationTargetHelper form of AnnotationTarget.getNamedAnnotationUsage(AnnotationDescriptor, String, String, ModelsContext)- Specified by:
getNamedAnnotationUsagein interfaceAnnotationTarget
-
replaceAnnotationUsage
default <S extends Annotation,P extends Annotation> P replaceAnnotationUsage(AnnotationDescriptor<S> repeatableType, AnnotationDescriptor<P> containerType, ModelsContext modelContext) Description copied from interface:MutableAnnotationTargetCreates and replaces (if any) an existing usage of the given annotation. For repeatable annotations, use Applies a usage of the givenannotationTypeto this target. Will return an existing usage, if one, or create a new usage.- Specified by:
replaceAnnotationUsagein interfaceMutableAnnotationTarget- See Also:
-
asAnnotationDescriptor
Description copied from interface:AnnotationTargetSafe cast method for cases when the target is an annotation.- Specified by:
asAnnotationDescriptorin interfaceAnnotationTarget
-
asFieldDetails
FieldDetails asFieldDetails()Description copied from interface:AnnotationTarget- Specified by:
asFieldDetailsin interfaceAnnotationTarget
-
asMethodDetails
MethodDetails asMethodDetails()Description copied from interface:AnnotationTarget- Specified by:
asMethodDetailsin interfaceAnnotationTarget
-
asRecordComponentDetails
RecordComponentDetails asRecordComponentDetails()Description copied from interface:AnnotationTargetSafe cast method for cases when the target is a record component.- Specified by:
asRecordComponentDetailsin interfaceAnnotationTarget
-
asClassDetails
MutableClassDetails asClassDetails()Description copied from interface:AnnotationTarget- Specified by:
asClassDetailsin interfaceAnnotationTarget- Specified by:
asClassDetailsin interfaceMutableAnnotationTarget
-
asMemberDetails
MutableMemberDetails asMemberDetails()Description copied from interface:AnnotationTarget- Specified by:
asMemberDetailsin interfaceAnnotationTarget- Specified by:
asMemberDetailsin interfaceMutableAnnotationTarget
-