Class ValueAcceptanceCriteria.Builder

  • Enclosing class:
    ValueAcceptanceCriteria

    public static final class ValueAcceptanceCriteria.Builder
    extends Object
    Builder for custom value acceptance criteria.
    Since:
    8.5.0
    • Method Detail

      • allowExtraneousRecordFields

        public ValueAcceptanceCriteria.Builder allowExtraneousRecordFields​(boolean allowExtraneousRecordFields)
        Controls whether extraneous fields in records are allowed that are not defined in the record descriptor.
        Parameters:
        allowExtraneousRecordFields - true if extraneous fields are allowed, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • allowExtraneousRecordFields

        public ValueAcceptanceCriteria.Builder allowExtraneousRecordFields()
        Allows extraneous fields in records that are not defined in the record descriptor.
        Returns:
        This builder instance for chaining method calls.
      • allowExtraneousTupleElements

        public ValueAcceptanceCriteria.Builder allowExtraneousTupleElements​(boolean allowExtraneousTupleElements)
        Controls whether extraneous elements in tuples are allowed, i.e. values at indices larger than the highest index defined in the tuple descriptor.
        Parameters:
        allowExtraneousTupleElements - true if extraneous elements are allowed, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • allowExtraneousTupleElements

        public ValueAcceptanceCriteria.Builder allowExtraneousTupleElements()
        Allows extraneous elements in tuples, i.e. values at indices larger than the highest index defined in the tuple descriptor.
        Returns:
        This builder instance for chaining method calls.
      • allowExtraneousVoidValues

        public ValueAcceptanceCriteria.Builder allowExtraneousVoidValues​(boolean allowExtraneousVoidValues)
        Whether to allow values for void descriptors. Void values must not have any value, i.e. must be null. This criterion controls whether such values are accepted or rejected.
        Parameters:
        allowExtraneousVoidValues - true if void values are accepted, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • allowExtraneousVoidValues

        public ValueAcceptanceCriteria.Builder allowExtraneousVoidValues()
        Allows values for void descriptors. Void values must not have any value, i.e. must be null. This criterion controls whether such values are accepted or rejected.
        Returns:
        This builder instance for chaining method calls.
      • allowMismatchingConst

        public ValueAcceptanceCriteria.Builder allowMismatchingConst​(boolean allowMismatchingConst)
        Controls whether constant values in constants are allowed to mismatch the defined constant value. Also applies to INullValueDescriptor, which is a constant null value.
        Parameters:
        allowMismatchingConst - true if mismatching constants are allowed, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • allowMissingRequiredRecordFields

        public ValueAcceptanceCriteria.Builder allowMissingRequiredRecordFields​(boolean allowMissingRequiredRecordFields)
        Controls whether records are allowed to have missing fields that are marked as required in the record descriptor.
        Parameters:
        allowMissingRequiredRecordFields - true if missing required fields are allowed, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • allowMissingRequiredRecordFields

        public ValueAcceptanceCriteria.Builder allowMissingRequiredRecordFields()
        Allows records to have missing fields that are marked as required in the record descriptor.
        Returns:
        This builder instance for chaining method calls.
      • allowMissingTupleElements

        public ValueAcceptanceCriteria.Builder allowMissingTupleElements​(boolean allowMissingTupleElements)
        Controls whether tuples are allowed to have fewer elements than defined in the tuple descriptor.
        Parameters:
        allowMissingTupleElements - true if missing fields are allowed, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • allowMissingTupleElements

        public ValueAcceptanceCriteria.Builder allowMissingTupleElements()
        Allows tuples to have fewer elements than defined in the tuple descriptor.
        Returns:
        This builder instance for chaining method calls.
      • allowNonStringKeys

        public ValueAcceptanceCriteria.Builder allowNonStringKeys​(boolean allowNonStringKeys)
        The keys of maps and records must be strings. This criterion controls whether non-string keys are ignored when checking for conformance.
        Parameters:
        allowNonStringKeys - true if non-string keys are allowed, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • allowNonStringKeys

        public ValueAcceptanceCriteria.Builder allowNonStringKeys()
        Allows the keys of maps and records to be non-strings. Keys must be strings, but this criterion controls whether non-string keys are ignored when checking for conformance.
        Returns:
        This builder instance for chaining method calls.
      • build

        public IValueAcceptanceCriteria build()
        Creates a new value acceptance criteria instance from the current builder state.
        Returns:
        A new value acceptance criteria instance.
      • disableTypeCoercion

        public ValueAcceptanceCriteria.Builder disableTypeCoercion()
        Disables type coercion of values.
        Returns:
        This builder instance for chaining method calls.
      • enableLargeStringInteroperability

        public ValueAcceptanceCriteria.Builder enableLargeStringInteroperability​(boolean enableLargeStringInteroperability)
        Whether to treat String and LargeString as equivalent types for the purpose of value acceptance. This allows, for example, a IStringValueDescriptor to accept a LargeString value.
        Parameters:
        enableLargeStringInteroperability - true to enable interoperability, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • enableTypeCoercion

        public ValueAcceptanceCriteria.Builder enableTypeCoercion​(Boolean enableTypeCoercion)
        Whether to enable type coercion of values. When true, allows coercion of values to conform to the defined value descriptor. For example, a floating-point number may be coerced to an integer by truncating the decimal part; or a string representing a number may be coerced to an actual numeric type.
        Parameters:
        enableTypeCoercion - true if type coercion is enabled, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • enableTypeCoercion

        public ValueAcceptanceCriteria.Builder enableTypeCoercion()
        Enables type coercion of values. Allows coercion of values to conform to the defined value descriptor. For example, a floating-point number may be coerced to an integer by truncating the decimal part; or a string representing a number may be coerced to an actual numeric type.
        Returns:
        This builder instance for chaining method calls.
      • enforceListItemConformance

        public ValueAcceptanceCriteria.Builder enforceListItemConformance​(boolean enforceListItemConformance)
        Controls whether each item in lists must conform to the defined item value descriptor.
        Parameters:
        enforceListItemConformance - true if each item must conform, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • enforceListItemConformance

        public ValueAcceptanceCriteria.Builder enforceListItemConformance()
        Requires that each item in lists must conform to the defined item value descriptor.
        Returns:
        This builder instance for chaining method calls.
      • enforceListLengthLowerBound

        public ValueAcceptanceCriteria.Builder enforceListLengthLowerBound​(boolean enforceListLengthLowerBound)
        Controls whether the length of list is enforced to not contain less than the defined minimum length.
        Parameters:
        enforceListLengthLowerBound - true if the list length lower bound is enforced, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • enforceListLengthLowerBound

        public ValueAcceptanceCriteria.Builder enforceListLengthLowerBound()
        Requires that the length of list is enforced to not contain less than the defined minimum length.
        Returns:
        This builder instance for chaining method calls.
      • enforceListLengthUpperBound

        public ValueAcceptanceCriteria.Builder enforceListLengthUpperBound​(boolean enforceListLengthUpperBound)
        Controls whether the length of lists is enforced to not contain more items than the defined maximum length of the list.
        Parameters:
        enforceListLengthUpperBound - true if the list length upper bound is enforced, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • enforceListLengthUpperBound

        public ValueAcceptanceCriteria.Builder enforceListLengthUpperBound()
        Requires that the length of lists is enforced to not contain more items than the defined maximum length of the list.
        Returns:
        This builder instance for chaining method calls.
      • enforceMapValueConformance

        public ValueAcceptanceCriteria.Builder enforceMapValueConformance​(boolean enforceMapValueConformance)
        Controls whether each value in maps must conform to the defined value descriptor.
        Parameters:
        enforceMapValueConformance - true if each value must conform, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • enforceMapValueConformance

        public ValueAcceptanceCriteria.Builder enforceMapValueConformance()
        Requires that each value in maps must conform to the defined value descriptor.
        Returns:
        This builder instance for chaining method calls.
      • enforceNumberRange

        public ValueAcceptanceCriteria.Builder enforceNumberRange​(boolean enforceNumberRange)
        Controls whether the value of integers and floats is enforced to be within the defined minimum and maximum value of the number.
        Parameters:
        enforceNumberRange - true if the number range is enforced, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • enforceNumberRange

        public ValueAcceptanceCriteria.Builder enforceNumberRange()
        Requires that the value of integers and floats is enforced to be within the defined minimum and maximum value of the number.
        Returns:
        This builder instance for chaining method calls.
      • enforceRecordOptionalFieldValueConformance

        public ValueAcceptanceCriteria.Builder enforceRecordOptionalFieldValueConformance​(boolean enforceRecordOptionalFieldValueConformance)
        Controls whether each optional field in records must conform to the defined value descriptor.
        Parameters:
        enforceRecordOptionalFieldValueConformance - true if each optional field must conform, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • enforceRecordOptionalFieldValueConformance

        public ValueAcceptanceCriteria.Builder enforceRecordOptionalFieldValueConformance()
        Requires that each optional field in records must conform to the defined value descriptor.
        Returns:
        This builder instance for chaining method calls.
      • enforceRecordRequiredFieldValueConformance

        public ValueAcceptanceCriteria.Builder enforceRecordRequiredFieldValueConformance​(boolean enforceRecordRequiredFieldValueConformance)
        Controls whether each required field in records must conform to the defined value descriptor.
        Parameters:
        enforceRecordRequiredFieldValueConformance - true if each required field must conform, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • enforceRecordRequiredFieldValueConformance

        public ValueAcceptanceCriteria.Builder enforceRecordRequiredFieldValueConformance()
        Requires that each required field in records must conform to the defined value descriptor.
        Returns:
        This builder instance for chaining method calls.
      • enforceStringLengthLowerBound

        public ValueAcceptanceCriteria.Builder enforceStringLengthLowerBound​(boolean enforceStringLengthLowerBound)
        Controls whether the length of strings is enforced to not be shorter than the defined minimum length of the string.
        Parameters:
        enforceStringLengthLowerBound - true if the string length lower bound is enforced, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • enforceStringLengthLowerBound

        public ValueAcceptanceCriteria.Builder enforceStringLengthLowerBound()
        Requires that the length of strings is enforced to not be shorter than the defined minimum length of the string.
        Returns:
        This builder instance for chaining method calls.
      • enforceStringLengthUpperBound

        public ValueAcceptanceCriteria.Builder enforceStringLengthUpperBound​(boolean enforceStringLengthUpperBound)
        Controls whether the length of strings is enforced to not be longer than the defined maximum length of the string.
        Parameters:
        enforceStringLengthUpperBound - true if the string length upper bound is enforced, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • enforceStringLengthUpperBound

        public ValueAcceptanceCriteria.Builder enforceStringLengthUpperBound()
        Requires that the length of strings is enforced to not be longer than the defined maximum length of the string.
        Returns:
        This builder instance for chaining method calls.
      • enforceTupleElementConformance

        public ValueAcceptanceCriteria.Builder enforceTupleElementConformance​(boolean enforceTupleElementConformance)
        Controls whether each element in tuples must conform to the defined value descriptor at the respective index.
        Parameters:
        enforceTupleElementConformance - true if each element must conform, false otherwise.
        Returns:
        This builder instance for chaining method calls.
      • enforceTupleElementConformance

        public ValueAcceptanceCriteria.Builder enforceTupleElementConformance()
        Requires that each element in tuples must conform to the defined value descriptor at the respective index.
        Returns:
        This builder instance for chaining method calls.
      • forbidExtraneousRecordFields

        public ValueAcceptanceCriteria.Builder forbidExtraneousRecordFields()
        Forbids extraneous fields in records that are not defined in the record descriptor.
        Returns:
        This builder instance for chaining method calls.
      • forbidExtraneousTupleElements

        public ValueAcceptanceCriteria.Builder forbidExtraneousTupleElements()
        Forbids extraneous elements in tuples, i.e. values at indices larger than the highest index defined in the tuple descriptor.
        Returns:
        This builder instance for chaining method calls.
      • forbidExtraneousVoidElements

        public ValueAcceptanceCriteria.Builder forbidExtraneousVoidElements()
        Forbids values for void descriptors. Void values must not have any value, i.e. must be null. This criterion controls whether such values are accepted or rejected.
        Returns:
        This builder instance for chaining method calls.
      • forbidMissingRequiredRecordFields

        public ValueAcceptanceCriteria.Builder forbidMissingRequiredRecordFields()
        Forbids records to have missing fields that are marked as required in the record descriptor.
        Returns:
        This builder instance for chaining method calls.
      • forbidMissingTupleElements

        public ValueAcceptanceCriteria.Builder forbidMissingTupleElements()
        Forbids tuples to have fewer elements than defined in the tuple descriptor.
        Returns:
        This builder instance for chaining method calls.
      • forbidNonStringKeys

        public ValueAcceptanceCriteria.Builder forbidNonStringKeys()
        Forbids the keys of maps and records to be non-strings. Keys must be strings, but this criterion controls whether non-string keys are ignored when checking for conformance.
        Returns:
        This builder instance for chaining method calls.
      • ignoreListItemConformance

        public ValueAcceptanceCriteria.Builder ignoreListItemConformance()
        Ignores the constraint that each an item in lists must conform to the defined item value descriptor.
        Returns:
        This builder instance for chaining method calls.
      • ignoreListLengthLowerBound

        public ValueAcceptanceCriteria.Builder ignoreListLengthLowerBound()
        Ignores the constraint that the length of lists is enforced to not contain less than the defined minimum length.
        Returns:
        This builder instance for chaining method calls.
      • ignoreListLengthUpperBound

        public ValueAcceptanceCriteria.Builder ignoreListLengthUpperBound()
        Ignores the constraint that the length of lists is enforced to not contain more items than the defined maximum length of the list.
        Returns:
        This builder instance for chaining method calls.
      • ignoreMapValueConformance

        public ValueAcceptanceCriteria.Builder ignoreMapValueConformance()
        Ignores the constraint that each value in maps must conform to the defined value descriptor.
        Returns:
        This builder instance for chaining method calls.
      • ignoreNumberRange

        public ValueAcceptanceCriteria.Builder ignoreNumberRange()
        Ignores the constraint that the value of integers and floats is enforced to be within the defined minimum and maximum value of the number.
        Returns:
        This builder instance for chaining method calls.
      • ignoreRecordOptionalFieldValueConformance

        public ValueAcceptanceCriteria.Builder ignoreRecordOptionalFieldValueConformance()
        Ignores the constraint that each optional field in records must conform to the defined value descriptor.
        Returns:
        This builder instance for chaining method calls.
      • ignoreRecordRequiredFieldValueConformance

        public ValueAcceptanceCriteria.Builder ignoreRecordRequiredFieldValueConformance()
        Ignores the constraint that each required field in records must conform to the defined value descriptor.
        Returns:
        This builder instance for chaining method calls.
      • ignoreStringLengthLowerBound

        public ValueAcceptanceCriteria.Builder ignoreStringLengthLowerBound()
        Ignores the constraint that the length of strings is enforced to not be shorter than the defined minimum length of the string.
        Returns:
        This builder instance for chaining method calls.
      • ignoreStringLengthUpperBound

        public ValueAcceptanceCriteria.Builder ignoreStringLengthUpperBound()
        Ignores the constraint that the length of strings is enforced to not be longer than the defined maximum length of the string.
        Returns:
        This builder instance for chaining method calls.
      • ignoreTupleElementConformance

        public ValueAcceptanceCriteria.Builder ignoreTupleElementConformance()
        Ignores the constraint that each element in tuples must conform to the defined value descriptor at the respective index.
        Returns:
        This builder instance for chaining method calls.
      • typeCoercer

        public ValueAcceptanceCriteria.Builder typeCoercer​(IValueDescriptorTypeCoercer typeCoercer)
        Enables types coercion of values. Sets a custom type coercer to use. For example, a floating-point number may be coerced to an integer by truncating the decimal part; or a string representing a number may be coerced to an actual numeric type.
        Parameters:
        typeCoercer - The type coercer to use.
        Returns:
        This builder instance for chaining method calls.