Enum Class UnknownKeyPolicy
- All Implemented Interfaces:
Serializable,Comparable<UnknownKeyPolicy>,Constable
What to do about configuration keys that no metadata on the project classpath
describes.
This is deliberately separate from FailurePolicy. A deprecated property is a
fact stated by the metadata, whereas an unrecognised key is only an absence of
evidence: the key may have been removed from Spring Boot, or it may be read by
application code the migrator cannot see. Folding the two together would let an
advisory finding break builds that were configured to fail only on real deprecations.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionDescribes why the policy was violated.booleanReturns whether the detector should run.booleanisViolatedBy(MigrationPlan plan) Returns whether the plan violates this policy.static Stringnames()Returns the accepted values, for use in error messages.static UnknownKeyPolicyParses a policy name, ignoring case and surrounding whitespace.static UnknownKeyPolicyReturns the enum constant of this class with the specified name.static UnknownKeyPolicy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
OFF
Do not look for unrecognised keys at all. -
REPORT
Report unrecognised keys without ever failing the build. -
FAIL
Report unrecognised keys and fail the build when any remains.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
parse
Parses a policy name, ignoring case and surrounding whitespace.- Parameters:
value- the configured value, which may benullor blank- Returns:
- the parsed policy, defaulting to
OFF - Throws:
IllegalArgumentException- if the value names no policy
-
names
Returns the accepted values, for use in error messages.- Returns:
- a human-readable list of policy names
-
isEnabled
public boolean isEnabled()Returns whether the detector should run.- Returns:
- whether unrecognised keys are looked for
-
isViolatedBy
Returns whether the plan violates this policy.- Parameters:
plan- the analysed plan- Returns:
- whether the build should fail
-
describeViolation
Describes why the policy was violated.- Parameters:
plan- the analysed plan- Returns:
- a message for the build failure
-