public final class BaseConstraints extends Object
Provides static factory methods which constructs instances of
| Modifier and Type | Method and Description |
|---|---|
static LengthConstraint |
newLengthConstraint(Number min,
Number max,
com.google.common.base.Optional<String> description,
com.google.common.base.Optional<String> reference)
Creates a
LengthConstraint. |
static LengthConstraint |
newLengthConstraint(Number min,
Number max,
com.google.common.base.Optional<String> description,
com.google.common.base.Optional<String> reference,
String errorAppTag,
String errorMessage)
Creates a
LengthConstraint. |
static PatternConstraint |
newPatternConstraint(String pattern,
com.google.common.base.Optional<String> description,
com.google.common.base.Optional<String> reference)
Creates a
PatternConstraint. |
static PatternConstraint |
newPatternConstraint(String pattern,
com.google.common.base.Optional<String> description,
com.google.common.base.Optional<String> reference,
String errorAppTag,
String errorMessage,
com.google.common.base.Optional<ModifierKind> modifier)
Creates a
PatternConstraint. |
static <T extends Number> |
newRangeConstraint(T min,
T max,
com.google.common.base.Optional<String> description,
com.google.common.base.Optional<String> reference)
Creates a
RangeConstraint. |
static <T extends Number> |
newRangeConstraint(T min,
T max,
com.google.common.base.Optional<String> description,
com.google.common.base.Optional<String> reference,
String errorAppTag,
String errorMessage)
Creates a
RangeConstraint. |
public static LengthConstraint newLengthConstraint(Number min, Number max, com.google.common.base.Optional<String> description, com.google.common.base.Optional<String> reference)
LengthConstraint.
Creates an instance of Length constraint based on supplied parameters with additional behaviour:
ConstraintMetaDefinition.getErrorAppTag() returns length-out-of-specified-bounds
ConstraintMetaDefinition.getErrorMessage() returns The argument is out of bounds
<min, max >
min - length-restricting lower bound value. The value MUST NOT be negative.max - length-restricting upper bound value. The value MUST NOT be negative.description - Description associated with constraint. Optional.absent() if description is undefined.reference - Reference associated with constraint. Optional.absent() if reference is undefined.LengthConstraintLengthConstraintpublic static LengthConstraint newLengthConstraint(Number min, Number max, com.google.common.base.Optional<String> description, com.google.common.base.Optional<String> reference, String errorAppTag, String errorMessage)
LengthConstraint.
Creates an instance of Length constraint based on supplied parameters with additional behaviour:
ConstraintMetaDefinition.getErrorAppTag() returns length-out-of-specified-bounds
ConstraintMetaDefinition.getErrorMessage() returns The argument is out of bounds
<min, max >
min - length-restricting lower bound value. The value MUST NOT be negative.max - length-restricting upper bound value. The value MUST NOT be negative.description - Description associated with constraint. Optional.absent() if description is undefined.reference - Reference associated with constraint. Optional.absent() if reference is undefined.errorAppTag - error-app-tag associated with constraint.errorMessage - error message associated with constraint.LengthConstraintLengthConstraintpublic static <T extends Number> RangeConstraint newRangeConstraint(T min, T max, com.google.common.base.Optional<String> description, com.google.common.base.Optional<String> reference)
RangeConstraint.
Creates an instance of Range constraint based on supplied parameters with additional behaviour:
ConstraintMetaDefinition.getErrorAppTag() returns range-out-of-specified-bounds
ConstraintMetaDefinition.getErrorMessage() returns The argument is out of bounds
<min, max >
T - Type of constraintmin - value-restricting lower bound value. The value MUST NOT Be null.max - value-restricting upper bound value. The value MUST NOT Be null.description - Description associated with constraint. Optional.absent() if description is undefined.reference - Reference associated with constraint. Optional.absent() if reference is undefined.RangeConstraintRangeConstraintpublic static <T extends Number> RangeConstraint newRangeConstraint(T min, T max, com.google.common.base.Optional<String> description, com.google.common.base.Optional<String> reference, String errorAppTag, String errorMessage)
RangeConstraint.
Creates an instance of Range constraint based on supplied parameters with additional behaviour:
ConstraintMetaDefinition.getErrorAppTag() returns range-out-of-specified-bounds
ConstraintMetaDefinition.getErrorMessage() returns The argument is out of bounds
<min, max >
T - Type of constraintmin - value-restricting lower bound value. The value MUST NOT Be null.max - value-restricting upper bound value. The value MUST NOT Be null.description - Description associated with constraint. Optional.absent() if description is undefined.reference - Reference associated with constraint. Optional.absent() if reference is undefined.errorAppTag - error-app-tag associated with constraint.errorMessage - error message associated with constraint.RangeConstraintRangeConstraintpublic static PatternConstraint newPatternConstraint(String pattern, com.google.common.base.Optional<String> description, com.google.common.base.Optional<String> reference)
PatternConstraint.
Creates an instance of Pattern constraint based on supplied parameters with additional behaviour:
ConstraintMetaDefinition.getErrorAppTag() returns
invalid-regular-expression
pattern - Regular expression, MUST NOT BE null.description - Description associated with constraint.reference - Reference associated with constraint.PatternConstraintPatternConstraintpublic static PatternConstraint newPatternConstraint(String pattern, com.google.common.base.Optional<String> description, com.google.common.base.Optional<String> reference, String errorAppTag, String errorMessage, com.google.common.base.Optional<ModifierKind> modifier)
PatternConstraint.
Creates an instance of Pattern constraint based on supplied parameters with additional behaviour:
ConstraintMetaDefinition.getErrorAppTag() returns
invalid-regular-expression
pattern - Regular expression, MUST NOT BE null.description - Description associated with constraint.reference - Reference associated with constraint.errorAppTag - error-app-tag associated with constraint.errorMessage - error message associated with constraint.modifier - Modifier of pattern constraint.PatternConstraintPatternConstraintCopyright © 2018 OpenDaylight. All rights reserved.