接口 OriginLookup<K>
- 类型参数:
K- the lookup key type
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
An interface that may be implemented by an object that can lookup
Origin
information from a given key. Can be used to add origin support to existing classes.- 从以下版本开始:
- 4.0
- 作者:
- Phillip Webb, Harry Yang
-
方法概要
修饰符和类型方法说明static <K> OriginAttempt to lookup the origin from the given source.Return the origin of the given key ornullif the origin cannot be determined.default StringReturn the implicit prefix that is applied when performing a lookup ornullif no prefix is used.default booleanReturntrueif this lookup is immutable and has contents that will never change.
-
方法详细资料
-
getOrigin
Return the origin of the given key ornullif the origin cannot be determined.- 参数:
key- the key to lookup- 返回:
- the origin of the key or
null
-
isImmutable
default boolean isImmutable()Returntrueif this lookup is immutable and has contents that will never change.- 返回:
- if the lookup is immutable
-
getPrefix
Return the implicit prefix that is applied when performing a lookup ornullif 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.- 返回:
- the prefix applied by the lookup class or
null.
-
getOrigin
Attempt to lookup the origin from the given source. If the source is not aOriginLookupor if an exception occurs during lookup thennullis returned.- 类型参数:
K- the key type- 参数:
source- the source objectkey- the key to lookup- 返回:
- an
Originornull
-