WebAnnotationSet (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.catalina.startup, class: WebAnnotationSet

# Class WebAnnotationSet

java.lang.Object
org.apache.catalina.startup.WebAnnotationSet

public class WebAnnotationSet extends Object
AnnotationSet for processing the annotations of the web application classes (`/WEB-INF/classes` and `/WEB-INF/lib`).

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final StringManager`
  `sm`
  The string resources for this package.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WebAnnotationSet()`
  Constructs a new WebAnnotationSet.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected static void`
  `addResource(Context context, Resource annotation)`
  Process a Resource annotation to set up a Resource.
  `protected static void`
  `addResource(Context context, Resource annotation, String defaultName, Class<?> defaultType)`
  Processes a Resource annotation with default name and type.
  `static void`
  `loadApplicationAnnotations(Context context)`
  Process the annotations on a context.
  `protected static void`
  `loadApplicationFilterAnnotations(Context context)`
  Process the annotations for the filters.
  `protected static void`
  `loadApplicationListenerAnnotations(Context context)`
  Process the annotations for the listeners.
  `protected static void`
  `loadApplicationServletAnnotations(Context context)`
  Process the annotations for the servlets.
  `protected static void`
  `loadClassAnnotation(Context context, Class<?> clazz)`
  Process the annotations on a context for a given className.
  `protected static void`
  `loadFieldsAnnotation(Context context, Class<?> clazz)`
  Processes @Resource annotations on fields of the given class.
  `protected static void`
  `loadMethodsAnnotation(Context context, Class<?> clazz)`
  Processes @Resource annotations on methods of the given class.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### sm

    protected static final StringManager sm
    The string resources for this package.

- ## Constructor Details

  - ### WebAnnotationSet

    public WebAnnotationSet()
    Constructs a new WebAnnotationSet.

- ## Method Details

  - ### loadApplicationAnnotations

    public static void loadApplicationAnnotations(Context context)
    Process the annotations on a context.
    Parameters:
      `context` - The context which will have its annotations processed

  - ### loadApplicationListenerAnnotations

    protected static void loadApplicationListenerAnnotations(Context context)
    Process the annotations for the listeners.
    Parameters:
      `context` - The context which will have its annotations processed

  - ### loadApplicationFilterAnnotations

    protected static void loadApplicationFilterAnnotations(Context context)
    Process the annotations for the filters.
    Parameters:
      `context` - The context which will have its annotations processed

  - ### loadApplicationServletAnnotations

    protected static void loadApplicationServletAnnotations(Context context)
    Process the annotations for the servlets.
    Parameters:
      `context` - The context which will have its annotations processed

  - ### loadClassAnnotation

    protected static void loadClassAnnotation(Context context, Class<?> clazz)
    Process the annotations on a context for a given className.
    Parameters:
      `context` - The context which will have its annotations processed
      `clazz` - The class to examine for Servlet annotations

  - ### loadFieldsAnnotation

    protected static void loadFieldsAnnotation(Context context, Class<?> clazz)
    Processes @Resource annotations on fields of the given class.
    Parameters:
      `context` - The context to add resources to
      `clazz` - The class to scan for field annotations

  - ### loadMethodsAnnotation

    protected static void loadMethodsAnnotation(Context context, Class<?> clazz)
    Processes @Resource annotations on methods of the given class.
    Parameters:
      `context` - The context to add resources to
      `clazz` - The class to scan for method annotations

  - ### addResource

    protected static void addResource(Context context, Resource annotation)
    Process a Resource annotation to set up a Resource. Ref JSR 250, equivalent to the resource-ref, message-destination-ref, env-ref, resource-env-ref or service-ref element in the deployment descriptor.
    Parameters:
      `context` - The context which will have its annotations processed
      `annotation` - The annotation that was found

  - ### addResource

    protected static void addResource(Context context, Resource annotation, String defaultName, Class<?> defaultType)
    Processes a Resource annotation with default name and type.
    Parameters:
      `context` - The context to add resources to
      `annotation` - The annotation
      `defaultName` - The default resource name
      `defaultType` - The default resource type