Class Utils


  • public class Utils
    extends Object
    Utility methods for detecting CDI scopes and JAX-RS components.
    Author:
    Jozef Hartinger
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • isJaxrsAnnotatedClass

        public static boolean isJaxrsAnnotatedClass​(Class<?> clazz)
        Finds out if a given class is decorated with JAX-RS annotations. Interfaces of the class are not scanned for JAX-RS annotations.
        Parameters:
        clazz - class
        Returns:
        true if a given interface has @Path annotation or if any of its methods is decorated with @Path annotation or a request method designator.
      • isJaxrsResource

        public static boolean isJaxrsResource​(Class<?> clazz)
        Returns true if and only if the given class is a JAX-RS root resource or a sub-resource. The class itself as well as its interfaces are scanned for JAX-RS annotations.
        Parameters:
        clazz - class
        Returns:
        true if the given class is JAX-RS resource or sub-resource
      • isJaxrsComponent

        public static boolean isJaxrsComponent​(Class<?> clazz)
        Find out if a given class is a JAX-RS component
        Parameters:
        clazz - class
        Returns:
        true if and only if a give class is a JAX-RS resource, provider or jakarta.ws.rs.core.Application subclass.
      • isScopeDefined

        public static boolean isScopeDefined​(jakarta.enterprise.inject.spi.AnnotatedType<?> annotatedType,
                                             jakarta.enterprise.inject.spi.BeanManager manager)
        Find out if a given annotated type is explicitly bound to a scope.
        Parameters:
        annotatedType - annotated type
        manager - bean manager
        Returns:
        true if and only if a given annotated type is annotated with a scope annotation or with a stereotype which (transitively) declares a scope