Package au.csiro.pathling.utilities
Class Default<T>
java.lang.Object
au.csiro.pathling.utilities.Default<T>
- Type Parameters:
T- the type of the value.
Represents a default value of type T. Simplifies resolution of values where null represents the
default, e.g:
Default<Integer> DEFAULT_VALUE = Default.of(100);
...
int value = DEFAULT_VALUE.resolve(valueOrNull);
-
Method Summary
-
Method Details
-
resolve
Resolved a nullable value to the value itself it not null or otherwise to the underlying default value.- Parameters:
value- the nullable value to resolve- Returns:
- the value of the default
-
of
Constructs the default value for given type T.- Type Parameters:
T- the type of the value.- Parameters:
defaultValue- the default value.- Returns:
- the default object.
-