V - the actual type of the tested valuepublic final class TypeCheckResult<V> extends Object
SerializableType.test(Object)| Modifier and Type | Method and Description |
|---|---|
static <V> TypeCheckResult<V> |
failed(V correctedValue)
Creates a failed
TypeCheckResult with the given value. |
Optional<V> |
getCorrectedValue()
Returns a possible corrected value based on the tested value.
|
boolean |
hasPassed()
Returns
true if the tested value passed the type check. |
static <V> TypeCheckResult<V> |
successful(V initialValue)
Creates a successful
TypeCheckResult with the given value. |
static <V> TypeCheckResult<V> |
unrecoverable()
Creates a failed
TypeCheckResult with no value. |
public static <V> TypeCheckResult<V> successful(V initialValue)
TypeCheckResult with the given value.public static <V> TypeCheckResult<V> failed(V correctedValue)
TypeCheckResult with the given value.public static <V> TypeCheckResult<V> unrecoverable()
TypeCheckResult with no value.public boolean hasPassed()
true if the tested value passed the type check.
A value passes if it matches every attribute set on
the SerializableType. If at least one constraint check failed,
this method returns false.
true if the test passed, false otherwise.public Optional<V> getCorrectedValue()
If the test passes, this method returns an Optional describing
the tested value.
Optional describing a possible corrected value,
or an empty Optional if the test was unrecoverable.