Package io.dialob.api.form
Class ImmutableValidation.Builder
java.lang.Object
io.dialob.api.form.ImmutableValidation.Builder
- Enclosing class:
- ImmutableValidation
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 Summary
Modifier and TypeMethodDescriptionbuild()Builds a newImmutableValidation.from(ModifiableValidation instance) Fill a builder with attribute values from the providedModifiableValidationinstance.from(Validation instance) Fill a builder with attribute values from the providedValidationinstance.Sets or replaces all mappings from the specified map as entries for themessagemap.putAllMessage(Map<String, ? extends String> entries) Put all mappings from the specified map as entries tomessagemap.putMessage(String key, String value) Put one entry to themessagemap.putMessage(Map.Entry<String, ? extends String> entry) Put one entry to themessagemap.Initializes the value for theruleattribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedModifiableValidationinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
from
Fill a builder with attribute values from the providedValidationinstance. 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:
thisbuilder for use in a chained invocation
-
putMessage
Put one entry to themessagemap.- Parameters:
key- The key in the message mapvalue- The associated value in the message map- Returns:
thisbuilder for use in a chained invocation
-
putMessage
Put one entry to themessagemap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder for use in a chained invocation
-
message
Sets or replaces all mappings from the specified map as entries for themessagemap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the message map- Returns:
thisbuilder for use in a chained invocation
-
putAllMessage
Put all mappings from the specified map as entries tomessagemap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the message map- Returns:
thisbuilder for use in a chained invocation
-
rule
Initializes the value for theruleattribute.- Parameters:
rule- The value for rule (can benull)- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newImmutableValidation.- Returns:
- An immutable instance of Validation
- Throws:
IllegalStateException- if any required attributes are missing
-