Package org.n52.io.response
Class OptionalOutput<T>
java.lang.Object
org.n52.io.response.OptionalOutput<T>
- Type Parameters:
T- the type of the output value to wrap.
Takes a value which may be marked as serialized or not. A caller still can force to retrieve the actual
value even not marked for serialization (by setting the appropriate flag). By default a value will be
marked to be serialized.
-
Method Summary
Modifier and TypeMethodDescriptionbooleangetValue()getValue(boolean forced) inthashCode()booleanisAbsent()booleanbooleanstatic <T> OptionalOutput<T>of(T value) Creates an instance which is serialized by default.static <T> OptionalOutput<T>of(T value, boolean serialize) Creates an instance with a flag indicating if given value shall be serialized or not.
-
Method Details
-
of
Creates an instance which is serialized by default.- Type Parameters:
T- the type of the output value to wrap- Parameters:
value- the output value (can benull)- Returns:
- a optional value which is serialized by default.
-
of
Creates an instance with a flag indicating if given value shall be serialized or not.- Type Parameters:
T- the type of the output value to wrap- Parameters:
value- the output value (can benull)serialize-trueif the value shall be serialized,falseotherwise.- Returns:
- a optional value indicating if it shall be serialied or not.
-
isSerialize
public boolean isSerialize() -
isPresent
public boolean isPresent() -
isAbsent
public boolean isAbsent() -
getValue
- Returns:
- the value if it shall be serialized,
nullotherwise.
-
getValue
- Parameters:
forced- if value shall be returned independent of serialization flag is set or not.- Returns:
- the acutal set value (can be
null).
-
equals
-
hashCode
public int hashCode()
-