Class ValueRangeBehavior
java.lang.Object
com.kingsrook.qqq.backend.core.model.metadata.fields.ValueRangeBehavior
- All Implemented Interfaces:
FieldBehavior<ValueRangeBehavior>
Validate the min invalid input: '&' max value for numeric fields.
For each min invalid input: '&' max, there are 4 possible settings:
- value - the number that is compared.
- allowEqualTo - defaults to true. controls if invalid input: '<' (>) or ≤ (≥)
- behavior - defaults to ERROR. optionally can be "CLIP" instead.
- clipAmount - if clipping, and not allowing equalTo, how much off the limit
value should be added or subtracted. Defaults to 1.
Convenient `withMin()` and `withMax()` methods exist for setting all 4
properties for each of min or max. Else, fluent-setters are recommended.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
control if multiple behaviors of this type should be allowed together on a field.void
apply
(ValueBehaviorApplier.Action action, List<QRecord> recordList, QInstance instance, QTableMetaData table, QFieldMetaData field) Apply this behavior to a list of recordsIn case a behavior of this type wasn't set on the field, what should the default of this type be?boolean
Getter for maxAllowEqualToGetter for maxBehaviorGetter for maxClipAmountGetter for maxValueboolean
Getter for minAllowEqualToGetter for minBehaviorGetter for minClipAmountGetter for minValuevoid
setMaxAllowEqualTo
(boolean maxAllowEqualTo) Setter for maxAllowEqualTovoid
setMaxBehavior
(ValueRangeBehavior.Behavior maxBehavior) Setter for maxBehaviorvoid
setMaxClipAmount
(BigDecimal maxClipAmount) Setter for maxClipAmountvoid
setMaxValue
(Number maxValue) Setter for maxValuevoid
setMinAllowEqualTo
(boolean minAllowEqualTo) Setter for minAllowEqualTovoid
setMinBehavior
(ValueRangeBehavior.Behavior minBehavior) Setter for minBehaviorvoid
setMinClipAmount
(BigDecimal minClipAmount) Setter for minClipAmountvoid
setMinValue
(Number minValue) Setter for minValuevalidateBehaviorConfiguration
(QTableMetaData tableMetaData, QFieldMetaData fieldMetaData) allow this behavior to be validated during QInstance validation.withMax
(Number value, boolean allowEqualTo, ValueRangeBehavior.Behavior behavior, BigDecimal clipAmount) withMaxAllowEqualTo
(boolean maxAllowEqualTo) Fluent setter for maxAllowEqualTowithMaxBehavior
(ValueRangeBehavior.Behavior maxBehavior) Fluent setter for maxBehaviorwithMaxClipAmount
(BigDecimal maxClipAmount) Fluent setter for maxClipAmountwithMaxValue
(Number maxValue) Fluent setter for maxValuewithMin
(Number value, boolean allowEqualTo, ValueRangeBehavior.Behavior behavior, BigDecimal clipAmount) withMinAllowEqualTo
(boolean minAllowEqualTo) Fluent setter for minAllowEqualTowithMinBehavior
(ValueRangeBehavior.Behavior minBehavior) Fluent setter for minBehaviorwithMinClipAmount
(BigDecimal minClipAmount) Fluent setter for minClipAmountwithMinValue
(Number minValue) Fluent setter for minValue
-
Constructor Details
-
ValueRangeBehavior
public ValueRangeBehavior()Constructor
-
-
Method Details
-
getDefault
Description copied from interface:FieldBehavior
In case a behavior of this type wasn't set on the field, what should the default of this type be?- Specified by:
getDefault
in interfaceFieldBehavior<ValueRangeBehavior>
-
apply
public void apply(ValueBehaviorApplier.Action action, List<QRecord> recordList, QInstance instance, QTableMetaData table, QFieldMetaData field) Description copied from interface:FieldBehavior
Apply this behavior to a list of records- Specified by:
apply
in interfaceFieldBehavior<ValueRangeBehavior>
-
allowMultipleBehaviorsOfThisType
public boolean allowMultipleBehaviorsOfThisType()Description copied from interface:FieldBehavior
control if multiple behaviors of this type should be allowed together on a field.- Specified by:
allowMultipleBehaviorsOfThisType
in interfaceFieldBehavior<ValueRangeBehavior>
-
validateBehaviorConfiguration
public List<String> validateBehaviorConfiguration(QTableMetaData tableMetaData, QFieldMetaData fieldMetaData) Description copied from interface:FieldBehavior
allow this behavior to be validated during QInstance validation. return a list of validation errors, if there are any.- Specified by:
validateBehaviorConfiguration
in interfaceFieldBehavior<ValueRangeBehavior>
-
withMin
public ValueRangeBehavior withMin(Number value, boolean allowEqualTo, ValueRangeBehavior.Behavior behavior, BigDecimal clipAmount) -
withMax
public ValueRangeBehavior withMax(Number value, boolean allowEqualTo, ValueRangeBehavior.Behavior behavior, BigDecimal clipAmount) -
getMinValue
Getter for minValue -
setMinValue
Setter for minValue -
withMinValue
Fluent setter for minValue -
getMaxValue
Getter for maxValue -
setMaxValue
Setter for maxValue -
withMaxValue
Fluent setter for maxValue -
getMinAllowEqualTo
public boolean getMinAllowEqualTo()Getter for minAllowEqualTo -
setMinAllowEqualTo
public void setMinAllowEqualTo(boolean minAllowEqualTo) Setter for minAllowEqualTo -
withMinAllowEqualTo
Fluent setter for minAllowEqualTo -
getMaxAllowEqualTo
public boolean getMaxAllowEqualTo()Getter for maxAllowEqualTo -
setMaxAllowEqualTo
public void setMaxAllowEqualTo(boolean maxAllowEqualTo) Setter for maxAllowEqualTo -
withMaxAllowEqualTo
Fluent setter for maxAllowEqualTo -
getMinBehavior
Getter for minBehavior -
setMinBehavior
Setter for minBehavior -
withMinBehavior
Fluent setter for minBehavior -
getMaxBehavior
Getter for maxBehavior -
setMaxBehavior
Setter for maxBehavior -
withMaxBehavior
Fluent setter for maxBehavior -
getMinClipAmount
Getter for minClipAmount -
setMinClipAmount
Setter for minClipAmount -
withMinClipAmount
Fluent setter for minClipAmount -
getMaxClipAmount
Getter for maxClipAmount -
setMaxClipAmount
Setter for maxClipAmount -
withMaxClipAmount
Fluent setter for maxClipAmount
-