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 TypeMethodDescriptionbooleancontrol if multiple behaviors of this type should be allowed together on a field.voidapply(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?booleanGetter for maxAllowEqualToGetter for maxBehaviorGetter for maxClipAmountGetter for maxValuebooleanGetter for minAllowEqualToGetter for minBehaviorGetter for minClipAmountGetter for minValuevoidsetMaxAllowEqualTo(boolean maxAllowEqualTo) Setter for maxAllowEqualTovoidsetMaxBehavior(ValueRangeBehavior.Behavior maxBehavior) Setter for maxBehaviorvoidsetMaxClipAmount(BigDecimal maxClipAmount) Setter for maxClipAmountvoidsetMaxValue(Number maxValue) Setter for maxValuevoidsetMinAllowEqualTo(boolean minAllowEqualTo) Setter for minAllowEqualTovoidsetMinBehavior(ValueRangeBehavior.Behavior minBehavior) Setter for minBehaviorvoidsetMinClipAmount(BigDecimal minClipAmount) Setter for minClipAmountvoidsetMinValue(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:FieldBehaviorIn case a behavior of this type wasn't set on the field, what should the default of this type be?- Specified by:
getDefaultin interfaceFieldBehavior<ValueRangeBehavior>
-
apply
public void apply(ValueBehaviorApplier.Action action, List<QRecord> recordList, QInstance instance, QTableMetaData table, QFieldMetaData field) Description copied from interface:FieldBehaviorApply this behavior to a list of records- Specified by:
applyin interfaceFieldBehavior<ValueRangeBehavior>
-
allowMultipleBehaviorsOfThisType
public boolean allowMultipleBehaviorsOfThisType()Description copied from interface:FieldBehaviorcontrol if multiple behaviors of this type should be allowed together on a field.- Specified by:
allowMultipleBehaviorsOfThisTypein interfaceFieldBehavior<ValueRangeBehavior>
-
validateBehaviorConfiguration
public List<String> validateBehaviorConfiguration(QTableMetaData tableMetaData, QFieldMetaData fieldMetaData) Description copied from interface:FieldBehaviorallow this behavior to be validated during QInstance validation. return a list of validation errors, if there are any.- Specified by:
validateBehaviorConfigurationin 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
-