Package io.dialob.api.form
Class ImmutableValidation
- java.lang.Object
-
- io.dialob.api.form.ImmutableValidation
-
- All Implemented Interfaces:
Validation,Serializable
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ImmutableValidation extends Object implements Validation
Immutable implementation ofValidation.Use the builder to create immutable instances:
ImmutableValidation.builder().- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableValidation.BuilderBuilds instances of typeImmutableValidation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableValidation.Builderbuilder()Creates a builder forImmutableValidation.static ImmutableValidationcopyOf(Validation instance)Creates an immutable copy of aValidationvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableValidationthat have equal attribute values.Map<String,String>getMessage()StringgetRule()inthashCode()Computes a hash code from attributes:message,rule.StringtoString()Prints the immutable valueValidationwith attribute values.ImmutableValidationwithMessage(Map<String,? extends String> entries)Copy the current immutable object by replacing themessagemap with the specified map.ImmutableValidationwithRule(String value)Copy the current immutable object by setting a value for theruleattribute.
-
-
-
Method Detail
-
getMessage
public Map<String,String> getMessage()
- Specified by:
getMessagein interfaceValidation- Returns:
- The value of the
messageattribute
-
getRule
public String getRule()
- Specified by:
getRulein interfaceValidation- Returns:
- The value of the
ruleattribute
-
withMessage
public final ImmutableValidation withMessage(Map<String,? extends String> entries)
Copy the current immutable object by replacing themessagemap with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
entries- The entries to be added to the message map- Returns:
- A modified copy of
thisobject
-
withRule
public final ImmutableValidation withRule(String value)
Copy the current immutable object by setting a value for theruleattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for rule (can benull)- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutableValidationthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:message,rule.
-
toString
public String toString()
Prints the immutable valueValidationwith attribute values.
-
copyOf
public static ImmutableValidation copyOf(Validation instance)
Creates an immutable copy of aValidationvalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable Validation instance
-
builder
public static ImmutableValidation.Builder builder()
Creates a builder forImmutableValidation.ImmutableValidation.builder() .putMessage|putAllMessage(String => String) //messagemappings .rule(String | null) // nullablerule.build();- Returns:
- A new ImmutableValidation builder
-
-