Enum ClassSource_Aggregate.ScanPolicy

java.lang.Object
java.lang.Enum<ClassSource_Aggregate.ScanPolicy>
com.ibm.wsspi.anno.classsource.ClassSource_Aggregate.ScanPolicy
All Implemented Interfaces:
Serializable, Comparable<ClassSource_Aggregate.ScanPolicy>
Enclosing interface:
ClassSource_Aggregate

public static enum ClassSource_Aggregate.ScanPolicy extends Enum<ClassSource_Aggregate.ScanPolicy>

Control value for processing web module components.

Scan policy values (getValue()) are intended to be bitwise OR'ed with each other to generate selection values for annotation target access. See, for example, AnnotationTargets_Targets.getAnnotatedClasses(), which obtains values for the seed region, and AnnotationTargets_Targets.getAnnotatedClasses(int), which obtains values for the regions specified by the scan policies parameter.

The four scan policies are not fully symmetric! Annotations are recorded for the seed, partial, and excluded regions, and are not recorded for the external region.

The purpose and utility of the scan policy partitioning of annotations is to support specialized rules for detecting annotations in web modules. Web modules obtain scan results for at least three purposes: Generation of Servlet metadata; Detection of Servlet Container Initializers (SCI); Generation of Managed Beans metadata. Of these three purposes, the first uses annotations from only the seed region, while SCI and Managed Beans uses annotations from all of the seed, partial, and excluded regions.

  • Enum Constant Details

    • SEED

      public static final ClassSource_Aggregate.ScanPolicy SEED

      Policy for non-metadata-complete regions of the target scan space. For JAR scans (EJB and CLIENT), this region will be of the JAR contents and nothing else. For WAR scans (WEB), this region will be the non-metadata complete subset of the WAR.

      Annotations are scanned from the seed region and are the results obtained by accessing annotations through the annotation targets table through default queries. For example: AnnotationTargets_Targets.getAnnotatedClasses().

    • PARTIAL

      public static final ClassSource_Aggregate.ScanPolicy PARTIAL

      Policy for metadata-complete (but not excluded) regions of the target scan space. This is intended to support WAR scans, which partition the WAR scan space into non-metadata-complete, metadata-complete, and excluded regions. The partial region included metadata-complete fragments. The partial region will include the WEB-INF/classes location if the main web module descriptor is metadata complete.

      Annotations are scanned from the partial region. However, the default queries do not obtain results from the partial region. To obtain results from the partial region, a scan policy selector must be provided. For example: AnnotationTargets_Targets.getAnnotatedClasses(int).

    • EXCLUDED

      public static final ClassSource_Aggregate.ScanPolicy EXCLUDED

      Policy for excluded regions of the target scan space. This is intended to support WAR scans, which partition the WAR scan space into non-metadata-complete, metadata-complete, and excluded regions. Excluded regions include those web module jars (jars under WEB-INF/lib) which are excluded from an absolute ordering in the main web module descriptor.

      Annotations are scanned from the excluded region. However, the default queries do not obtain results from the partial region. To obtain results from the partial region, a scan policy selector must be provided. For example: AnnotationTargets_Targets.getAnnotatedClasses(int).

    • EXTERNAL

      public static final ClassSource_Aggregate.ScanPolicy EXTERNAL

      Policy for regions outside of the core region of the target scan space. For all module type scans (EJB and CLIENT for JAR files, WEB for WAR files), this includes all parts of the scan space which is external to the target module. For most modules, this includes the module MANIFEST class path elements, JAR files from the application library, JAR files from shared libraries, and any elements of the module external references class loader.

      The external region has two distinguishing features which differentiate it from the seed, partial, and excluded regions:

      • The external region is only scanned to complete class information for classes from the other regions.
      • No annotations are recorded for classes scanned from the external region.
  • Field Details

    • ALL_EXCEPT_EXTERNAL

      public static final int ALL_EXCEPT_EXTERNAL

      Helper: Bitwise OR of all recorded regions (SEED, PARTIAL, EXCLUDED.

  • Method Details

    • values

      public static ClassSource_Aggregate.ScanPolicy[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static ClassSource_Aggregate.ScanPolicy valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public int getValue()

      Integer value for the scan policy. This is intended to be bitwise OR'ed to generate scan policy selectors for annotation targets methods.

      Returns:
      An integer value for the scan policy.
    • accept

      public boolean accept(int policies)

      Tell if this scan policy accepts the specified policy selector. The selector is accepted if it contains the bit value of the scan policy.

      Parameters:
      policies - The bitwise OR of scan policy values to test.
      Returns:
      True if the bit value of this scan policy is set in the policies. Otherwise, false. getValue()
    • isSingular

      public static boolean isSingular(int policies)

      Tell if the scan policy is singular -- has only one scan policy bit value set.

      Parameters:
      policies - The bitwise OR of scan policy values to test.
      Returns:
      True if exactly one policy bit value is set. Otherwise, false. getValue()
    • asSingular

      public static ClassSource_Aggregate.ScanPolicy asSingular(int policies)

      Answer the singular policy which is represented by a scan policy selector. Answer null if the scan policy selector does not match exactly one scan policy.

      Parameters:
      policies - A bitwise OR of scan value policies.
      Returns:
      The single scan policy which matches the scan policy selector. Null if the scan policy selector does not exactly one scan policy. getValue()