Class JsrSupport
Centralizes all framework annotation-name matching for:
- JSR-330 style injection annotations (
jakarta.inject /javax.inject ). - JSR-250 lifecycle annotations (
jakarta.annotation /javax.annotation ). - Spring's
Autowired annotation.
Juneau intentionally matches by annotation class name so modules can interoperate with these annotations without compile-time dependencies on their APIs.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisInjectAnnotation(AnnotationInfo<?> annotation) Returnstrue if the annotation is an inject marker.static booleanisNamedAnnotation(AnnotationInfo<?> annotation) Returnstrue if the annotation is a named qualifier.static booleanisPostConstructAnnotation(AnnotationInfo<?> annotation) Returnstrue if the annotation is a post-construct lifecycle marker.static booleanisPreDestroyAnnotation(AnnotationInfo<?> annotation) Returnstrue if the annotation is a pre-destroy lifecycle marker.static booleanisProviderType(Class<?> type) Returnstrue if the class is a supported provider interface.static booleanisQualifierMeta(AnnotationInfo<?> annotation) Returnstrue if this annotation type itself is annotated with a qualifier marker.static booleanisSingletonAnnotation(AnnotationInfo<?> annotation) Returnstrue if the annotation is a singleton marker.static booleanisValidAnnotation(AnnotationInfo<?> annotation) Returnstrue if the annotation is a Jakarta Bean Validation opt-in marker.static booleanisValueAnnotation(AnnotationInfo<?> annotation) Returnstrue if the annotation is a config-value marker.static StringqualifierValue(AnnotationInfo<?> annotation) Reads qualifier value from an annotation when supported.static StringvalueExpression(AnnotationInfo<?> annotation) Returns the configuration expression carried by a@Valueannotation, ornullif the annotation is not a recognized@Value.
-
Field Details
-
JUNEAU_INJECT
- See Also:
-
JAKARTA_INJECT
- See Also:
-
JAVAX_INJECT
- See Also:
-
SPRING_AUTOWIRED
- See Also:
-
JUNEAU_NAMED
- See Also:
-
JAKARTA_NAMED
- See Also:
-
JAVAX_NAMED
- See Also:
-
JUNEAU_QUALIFIER
- See Also:
-
JAKARTA_QUALIFIER
- See Also:
-
JAVAX_QUALIFIER
- See Also:
-
JUNEAU_SINGLETON
- See Also:
-
JAKARTA_SINGLETON
- See Also:
-
JAVAX_SINGLETON
- See Also:
-
JUNEAU_PROVIDER
- See Also:
-
JAKARTA_PROVIDER
- See Also:
-
JAVAX_PROVIDER
- See Also:
-
JUNEAU_POSTCONSTRUCT
- See Also:
-
JAKARTA_POSTCONSTRUCT
- See Also:
-
JAVAX_POSTCONSTRUCT
- See Also:
-
JUNEAU_PREDESTROY
- See Also:
-
JAKARTA_PREDESTROY
- See Also:
-
JAVAX_PREDESTROY
- See Also:
-
JUNEAU_VALUE
- See Also:
-
SPRING_VALUE
- See Also:
-
JAKARTA_VALID
- See Also:
-
JAVAX_VALID
- See Also:
-
SPRING_VALIDATED
- See Also:
-
-
Method Details
-
isInjectAnnotation
Returnstrue if the annotation is an inject marker.- Parameters:
annotation- The annotation to inspect. Must not benull .- Returns:
true if the annotation is an inject marker.
-
isNamedAnnotation
Returnstrue if the annotation is a named qualifier.- Parameters:
annotation- The annotation to inspect. Must not benull .- Returns:
true if the annotation is a named qualifier.
-
isQualifierMeta
Returnstrue if this annotation type itself is annotated with a qualifier marker.- Parameters:
annotation- The annotation to inspect. Must not benull .- Returns:
true if this annotation type itself is annotated with a qualifier marker.
-
isSingletonAnnotation
Returnstrue if the annotation is a singleton marker.- Parameters:
annotation- The annotation to inspect. Must not benull .- Returns:
true if the annotation is a singleton marker.
-
isProviderType
Returnstrue if the class is a supported provider interface.- Parameters:
type- The class to inspect. Can benull , in which casefalse is returned.- Returns:
true if the class is a supported provider interface.
-
isPostConstructAnnotation
Returnstrue if the annotation is a post-construct lifecycle marker.- Parameters:
annotation- The annotation to inspect. Must not benull .- Returns:
true if the annotation is a post-construct lifecycle marker.
-
isPreDestroyAnnotation
Returnstrue if the annotation is a pre-destroy lifecycle marker.- Parameters:
annotation- The annotation to inspect. Must not benull .- Returns:
true if the annotation is a pre-destroy lifecycle marker.
-
qualifierValue
Reads qualifier value from an annotation when supported.For
@Named , returns the annotation value directly. For qualifier-meta annotations, this returns the annotation's ownvalue() attribute if present and string-typed.- Parameters:
annotation- The annotation to inspect. Must not benull .- Returns:
- The qualifier value, or
null if the annotation carries no qualifier value.
-
isValueAnnotation
Returnstrue if the annotation is a config-value marker.Recognizes both Juneau's
@Valueand Spring'sorg.springframework.beans.factory.annotation.Valueby FQN — no compile-time Spring dependency injuneau-commons.- Parameters:
annotation- The annotation to inspect. Must not benull .- Returns:
true ifannotationis one of the recognized@Valuevariants.
-
valueExpression
Returns the configuration expression carried by a@Valueannotation, ornullif the annotation is not a recognized@Value.Both Juneau's
@Valueand Spring's@Valueexpose a singleString value()attribute, so a uniformgetValue()lookup against the annotation works for either.- Parameters:
annotation- The annotation to inspect. Must not benull .- Returns:
- The
value()string, ornullifannotationis not a@Value.
-
isValidAnnotation
Returnstrue if the annotation is a Jakarta Bean Validation opt-in marker.Recognizes Jakarta 3.x (
jakarta.validation.Valid), the older Javax 2.x equivalent (javax.validation.Valid), and Spring's@Validatedgroup-selector by FQN — no compile-time Jakarta Validation or Spring dependency injuneau-commons.- Parameters:
annotation- The annotation to inspect. Must not benull .- Returns:
true ifannotationis one of the recognized validation opt-in markers.
-