Class ImmutableValidation.Builder

  • Enclosing class:
    ImmutableValidation

    @NotThreadSafe
    public static final class ImmutableValidation.Builder
    extends Object
    Builds instances of type ImmutableValidation. Initialize attributes and then invoke the build() method to create an immutable instance.

    Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

    • Method Detail

      • from

        public final ImmutableValidation.Builder from​(ModifiableValidation instance)
        Fill a builder with attribute values from the provided ModifiableValidation instance.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • from

        public final ImmutableValidation.Builder from​(Validation instance)
        Fill a builder with attribute values from the provided Validation instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • putMessage

        public final ImmutableValidation.Builder putMessage​(String key,
                                                            String value)
        Put one entry to the message map.
        Parameters:
        key - The key in the message map
        value - The associated value in the message map
        Returns:
        this builder for use in a chained invocation
      • message

        public final ImmutableValidation.Builder message​(Map<String,​? extends String> entries)
        Sets or replaces all mappings from the specified map as entries for the message map. Nulls are not permitted
        Parameters:
        entries - The entries that will be added to the message map
        Returns:
        this builder for use in a chained invocation
      • putAllMessage

        public final ImmutableValidation.Builder putAllMessage​(Map<String,​? extends String> entries)
        Put all mappings from the specified map as entries to message map. Nulls are not permitted
        Parameters:
        entries - The entries that will be added to the message map
        Returns:
        this builder for use in a chained invocation
      • rule

        public final ImmutableValidation.Builder rule​(String rule)
        Initializes the value for the rule attribute.
        Parameters:
        rule - The value for rule (can be null)
        Returns:
        this builder for use in a chained invocation