Detect Enum or Field (detectEnumOrField)

<detectEnumOrField> Element

The detectEnumOrField rule is used to detect enums or fields in Java classes.

Table 1. <detectEnumOrField> Element Attributes
Attribute Name Type Required Description
type String Yes

The fully qualified class name of the enum or field type.

value String Yes

The string literal value of the enum or name of the field.

flagOnce Boolean No

Indicates whether to flag once per archive. Defaults to false.

flagOncePerFile Boolean No

Indicates whether to flag once per file. Defaults to false.

hideResult Boolean No

Indicates whether results flagged by this rule should be hidden in the report. This attribute only hides results when used with rules under the <and> or <or> tags. Defaults to false.

For example, to detect a javax.servlet.annotation.ServletSecurity$TransportGuarantee enum with the value CONFIDENTIAL, specify:


<detectEnumOrField type="javax.servlet.annotation.ServletSecurity$TransportGuarantee" value="CONFIDENTIAL"/>