Class JsonNullable<T>
- java.lang.Object
-
- org.openapitools.jackson.nullable.JsonNullable<T>
-
- All Implemented Interfaces:
Serializable
public class JsonNullable<T> extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Tget()Obtain the value of thisJsonNullable.inthashCode()voidifPresent(Consumer<? super T> action)If a value is present, performs the given action with the value, otherwise does nothing.booleanisPresent()static <T> JsonNullable<T>of(T value)Create aJsonNullablefrom the submitted value.TorElse(T other)Obtain the value of thisJsonNullable.StringtoString()static <T> JsonNullable<T>undefined()Create aJsonNullablerepresenting an undefined value (not present).
-
-
-
Method Detail
-
undefined
public static <T> JsonNullable<T> undefined()
Create aJsonNullablerepresenting an undefined value (not present).- Type Parameters:
T- a type wildcard- Returns:
- an empty
JsonNullablewith no value defined
-
of
public static <T> JsonNullable<T> of(T value)
Create aJsonNullablefrom the submitted value.- Type Parameters:
T- the type of the value- Parameters:
value- the value- Returns:
- the
JsonNullablewith the submitted value present.
-
get
public T get()
Obtain the value of thisJsonNullable.- Returns:
- the value, if present
- Throws:
NoSuchElementException- if no value is present
-
orElse
public T orElse(T other)
Obtain the value of thisJsonNullable.- Parameters:
other- the value to be returned if no value is present- Returns:
- the value of this
JsonNullableif present, the submitted value otherwise
-
isPresent
public boolean isPresent()
-
ifPresent
public void ifPresent(Consumer<? super T> action)
If a value is present, performs the given action with the value, otherwise does nothing.- Parameters:
action- the action to be performed, if a value is present
-
-