K
- the lookup key type@FunctionalInterface public interface OriginLookup<K>
Origin
information from a given key. Can be used to add origin support to existing classes.Modifier and Type | Method and Description |
---|---|
Origin |
getOrigin(K key)
Return the origin of the given key or
null if the origin cannot be
determined. |
static <K> Origin |
getOrigin(Object source,
K key)
Attempt to look up the origin from the given source.
|
default String |
getPrefix()
Return the implicit prefix that is applied when performing a lookup or
null
if no prefix is used. |
default boolean |
isImmutable()
Return
true if this lookup is immutable and has contents that will never
change. |
Origin getOrigin(K key)
null
if the origin cannot be
determined.key
- the key to lookupnull
default boolean isImmutable()
true
if this lookup is immutable and has contents that will never
change.default String getPrefix()
null
if no prefix is used. Prefixes can be used to disambiguate keys that would
otherwise clash. For example, if multiple applications are running on the same
machine a different prefix can be set on each application to ensure that different
environment variables are used.null
.static <K> Origin getOrigin(Object source, K key)
OriginLookup
or if an exception occurs during lookup then null
is
returned.K
- the key typesource
- the source objectkey
- the key to lookupOrigin
or null