Package com.github.tonivade.purefun.type
Record Class Validation.Valid<E,T>
java.lang.Object
java.lang.Record
com.github.tonivade.purefun.type.Validation.Valid<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.Valid<E,T> (T value)
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.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.value()Returns the value of thevaluerecord component.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
-
value
The field for thevaluerecord component.
-
-
Constructor Details
-
Valid
Creates an instance of aValidrecord class.- Parameters:
value- the value for thevaluerecord 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). -
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-