接口 OriginLookup<K>

类型参数:
K - the lookup key type
所有已知实现类:
ConfigTreePropertySource, OriginTrackedMapPropertySource, SystemEnvironmentPropertySourceEnvironmentPostProcessor.OriginAwareSystemEnvironmentPropertySource
函数接口:
这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

@FunctionalInterface public interface OriginLookup<K>
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
    getOrigin(Object source, K key)
    Attempt to look up the origin from the given source.
    getOrigin(K key)
    Return the origin of the given key or null if the origin cannot be determined.
    default String
    Return the implicit prefix that is applied when performing a lookup or null if no prefix is used.
    default boolean
    Return true if this lookup is immutable and has contents that will never change.
  • 方法详细资料

    • getOrigin

      Origin getOrigin(K key)
      Return the origin of the given key or null if the origin cannot be determined.
      参数:
      key - the key to lookup
      返回:
      the origin of the key or null
    • isImmutable

      default boolean isImmutable()
      Return true if this lookup is immutable and has contents that will never change.
      返回:
      if the lookup is immutable
      从以下版本开始:
      2.2.0
    • getPrefix

      default String getPrefix()
      Return the implicit prefix that is applied when performing a lookup or 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.
      返回:
      the prefix applied by the lookup class or null.
      从以下版本开始:
      2.5.0
    • getOrigin

      static <K> Origin getOrigin(Object source, K key)
      Attempt to look up the origin from the given source. If the source is not a OriginLookup or if an exception occurs during lookup then null is returned.
      类型参数:
      K - the key type
      参数:
      source - the source object
      key - the key to lookup
      返回:
      an Origin or null