Enum Class FailurePolicy
- All Implemented Interfaces:
Serializable,Comparable<FailurePolicy>,Constable
When a migration run should fail the build.
Replaces a plain failOnError flag, which only ever considered properties that
had no replacement and so could not express the case teams actually want in CI: fail
while any deprecated property remains.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionFail when any deprecated property is present, including ones that were or could be migrated automatically.Fail when a finding needs a human, either because migrating it is not provably safe or because the property has no replacement at all.Report findings but always succeed. -
Method Summary
Modifier and TypeMethodDescriptionDescribes why the policy was violated.booleanisViolatedBy(MigrationPlan plan) Returns whether the plan violates this policy.static Stringnames()Returns the accepted values, for use in error messages.static FailurePolicyParses a policy name, ignoring case and surrounding whitespace.static FailurePolicyReturns the enum constant of this class with the specified name.static FailurePolicy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NEVER
Report findings but always succeed. -
MANUAL
Fail when a finding needs a human, either because migrating it is not provably safe or because the property has no replacement at all. -
ANY
Fail when any deprecated property is present, including ones that were or could be migrated automatically.
-
-
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
NEVER - 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
-
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
-