Package de.fxlae.typeid.util
Record Class Validated.Invalid<T>
java.lang.Object
java.lang.Record
de.fxlae.typeid.util.Validated.Invalid<T>
- Record Components:
message- the error message
- All Implemented Interfaces:
Validated<T>
Implementation of an "invalid
Validated".-
Nested Class Summary
Nested classes/interfaces inherited from interface de.fxlae.typeid.util.Validated
Validated.Invalid<T>, Validated.Valid<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.<O> Validated<O>Applies the provided mapping function if the value is valid, otherwise returns the current instanceget()Returns the value if it's valid, otherwise throws.final inthashCode()Returns a hash code value for this object.voidApplies the message consuming function if the value is invalid, otherwise does nothing.voidApplies the consuming function if the value is valid, otherwise does nothing.booleanisValid()Returnstrueif the value is valid, otherwisefalse.<O> Validated<O>Applies the provided mapping function if the value is valid, otherwise returns the current instancemessage()Returns the value of themessagerecord component.Returns the value if valid, otherwise returnother.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Invalid
Creates an instance of aInvalidrecord class.- Parameters:
message- the value for themessagerecord component
-
-
Method Details
-
toOptional
Description copied from interface:ValidatedReturns anOptionalwith the valid value, otherwise an emptyOptional. In the latter case, the error message is lost.- Specified by:
toOptionalin interfaceValidated<T>- Returns:
- the
Optional
-
isValid
public boolean isValid()Description copied from interface:ValidatedReturnstrueif the value is valid, otherwisefalse. -
get
Description copied from interface:ValidatedReturns the value if it's valid, otherwise throws. -
orElse
Description copied from interface:ValidatedReturns the value if valid, otherwise returnother. -
map
Description copied from interface:ValidatedApplies the provided mapping function if the value is valid, otherwise returns the current instance -
flatMap
Description copied from interface:ValidatedApplies the provided mapping function if the value is valid, otherwise returns the current instance -
filter
Description copied from interface:Validated -
ifValid
Description copied from interface:ValidatedApplies the consuming function if the value is valid, otherwise does nothing. -
ifInvalid
Description copied from interface:ValidatedApplies the message consuming function if the value is invalid, otherwise does nothing. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
message
Returns the value of themessagerecord component.
-