T
- The type of the contained object.public class ConvertedObject<T> extends Object
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
static <T> ConvertedObject<T> |
fromConverted(T convertedObject)
Creates a
ConvertedObject containing the given object as its value. |
static <T> ConvertedObject<T> |
fromNull()
Creates a
ConvertedObject containing null as its value. |
T |
get() |
int |
hashCode() |
static <T> ConvertedObject<T> |
notConvertable()
Creates a
ConvertedObject containing null as its value. |
T |
or(T defaultValue)
Returns the contained value, or the given default value if the object was not convertible.
|
T |
orNull()
Returns the contained value, or
null if the object was not convertible. |
String |
toString() |
@Nullable public T get() throws ObjectNotConvertableException
null
.ObjectNotConvertableException
- If the object is not convertable.public T orNull()
null
if the object was not convertible.null
if the object was not convertible.public T or(T defaultValue)
defaultValue
- The value to return in case this ConvertedObject
was not convertible.public static <T> ConvertedObject<T> fromConverted(@Nullable T convertedObject)
ConvertedObject
containing the given object as its value.T
- The type of the object to wrap.convertedObject
- The object to wrap in a ConvertedObject
.ConvertedObject
wrapping convertedObject
.public static <T> ConvertedObject<T> fromNull()
ConvertedObject
containing null as its value. The reason to use this method might be that no
object was given to convert.T
- The type the contained value should have.ConvertedObject
containing only null.public static <T> ConvertedObject<T> notConvertable()
ConvertedObject
containing null as its value. The reason to use this method might be that the
given object could not be converted.T
- The type the contained value should have.ConvertedObject
containing only null.Copyright © 2018 SAP SE. All rights reserved.