Package com.github.tonivade.purefun.type
Record Class Validation.Invalid<E,T>
java.lang.Object
java.lang.Record
com.github.tonivade.purefun.type.Validation.Invalid<E,T>
- All Implemented Interfaces:
Bindable<Validation<E,,?>, T> Mappable<Validation<E,,?>, T> Kind<Validation<E,,?>, T> Validation<E,,T> ValidationOf<E,,T> Serializable
- Enclosing interface:
Validation<E,T>
public static record Validation.Invalid<E,T> (E error)
extends Record
implements Validation<E,T>, Serializable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.github.tonivade.purefun.type.Validation
Validation.Invalid<E,T>, Validation.Result<E>, Validation.Valid<E, T> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.error()Returns the value of theerrorrecord component.get()Returns the valid value if available.getError()Returns the invalid value if available.final inthashCode()Returns a hash code value for this object.booleanbooleanisValid()toString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.github.tonivade.purefun.type.Validation
ap, bimap, filter, filterNot, filterOrElse, flatMap, fold, getOrElse, getOrElse, getOrElseNull, getOrElseThrow, getOrElseThrow, map, mapError, or, orElse, toEither
-
Field Details
-
error
The field for theerrorrecord component.
-
-
Constructor Details
-
Invalid
Creates an instance of aInvalidrecord class.- Parameters:
error- the value for theerrorrecord component
-
-
Method Details
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceValidation<E,T>
-
isInvalid
public boolean isInvalid()- Specified by:
isInvalidin interfaceValidation<E,T>
-
get
Description copied from interface:ValidationReturns the valid value if available. If not, it throwsNoSuchElementException- Specified by:
getin interfaceValidation<E,T> - Returns:
- the valid value
-
getError
Description copied from interface:ValidationReturns the invalid value if available. If not, it throwsNoSuchElementException- Specified by:
getErrorin interfaceValidation<E,T> - Returns:
- the invalid value
-
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). -
error
Returns the value of theerrorrecord component.- Returns:
- the value of the
errorrecord component
-