Interface EitherHolder<T>
public interface EitherHolder<T>
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if this holder is backed by a direct value.boolean
hasKey()
Returns true if this holder has a resource key.holder()
Returns the value of this holder.key()
Returns the resource key.static <T> EitherHolder<T>
Returns a direct or indirect value holder.static <T> EitherHolder<T>
Returns an indirect holder via the resource key.
-
Method Details
-
of
Returns a direct or indirect value holder.- Type Parameters:
T
- the type of the value- Parameters:
value
- the value- Returns:
- a new direct holder
-
of
Returns an indirect holder via the resource key.- Type Parameters:
T
- the type of the value- Parameters:
key
- the resource key- Returns:
- a new holder with the given resource key
-
hasHolder
boolean hasHolder()Returns true if this holder is backed by a direct value.- Returns:
- true if the holder is direct
- See Also:
-
hasKey
boolean hasKey()Returns true if this holder has a resource key.- Returns:
- true if this holder has a resource key
- See Also:
-
holder
Returns the value of this holder.- Returns:
- the value of this holder
- Throws:
IllegalArgumentException
- if this contains a resource key instead of a holder- See Also:
-
key
String key()Returns the resource key.- Returns:
- the resource key
- Throws:
IllegalArgumentException
- if this contains a holder instead of a resource key- See Also:
-