接口 OriginLookup<K>
- 类型参数:
K
- the lookup key type
- 所有已知实现类:
ConfigTreePropertySource
,OriginTrackedMapPropertySource
,SystemEnvironmentPropertySourceEnvironmentPostProcessor.OriginAwareSystemEnvironmentPropertySource
- 函数接口:
- 这是一个函数接口, 因此可用作 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.- 从以下版本开始:
- 2.0.0
- 作者:
- Phillip Webb
-
方法概要
修饰符和类型方法说明static <K> Origin
Attempt to look up the origin from the given source.Return the origin of the given key ornull
if the origin cannot be determined.default String
Return the implicit prefix that is applied when performing a lookup ornull
if no prefix is used.default boolean
Returntrue
if this lookup is immutable and has contents that will never change.
-
方法详细资料
-
getOrigin
Return the origin of the given key ornull
if the origin cannot be determined.- 参数:
key
- the key to lookup- 返回:
- the origin of the key or
null
-
isImmutable
default boolean isImmutable()Returntrue
if this lookup is immutable and has contents that will never change.- 返回:
- if the lookup is immutable
- 从以下版本开始:
- 2.2.0
-
getPrefix
Return the implicit prefix that is applied when performing a lookup ornull
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.- 返回:
- the prefix applied by the lookup class or
null
. - 从以下版本开始:
- 2.5.0
-
getOrigin
Attempt to look up the origin from the given source. If the source is not aOriginLookup
or if an exception occurs during lookup thennull
is returned.- 类型参数:
K
- the key type- 参数:
source
- the source objectkey
- the key to lookup- 返回:
- an
Origin
ornull
-