接口 Origin

所有已知实现类:
PropertySourceOrigin, SystemEnvironmentOrigin, TextResourceOrigin

public interface Origin
Interface that uniquely represents the origin of an item. For example, an item loaded from a File may have an origin made up of the file name along with line/column numbers.

Implementations must provide sensible hashCode(), equals(...) and #toString() implementations.

从以下版本开始:
4.0
作者:
Madhura Bhave, Phillip Webb, Harry Yang
另请参阅:
  • 方法概要

    修饰符和类型
    方法
    说明
    static Origin
    from(Object source)
    Find the Origin that an object originated from.
    default Origin
    Return the parent origin for this instance if there is one.
    static List<Origin>
    Find the parents of the Origin that an object originated from.
  • 方法详细资料

    • getParent

      @Nullable default Origin getParent()
      Return the parent origin for this instance if there is one. The parent origin provides the origin of the item that created this one.
      返回:
      the parent origin or null
      另请参阅:
    • from

      @Nullable static Origin from(@Nullable Object source)
      Find the Origin that an object originated from. Checks if the source object is an Origin or OriginProvider and also searches exception stacks.
      参数:
      source - the source object or null
      返回:
      an optional Origin
    • parentsFrom

      static List<Origin> parentsFrom(@Nullable Object source)
      Find the parents of the Origin that an object originated from. Checks if the source object is an Origin or OriginProvider and also searches exception stacks. Provides a list of all parents up to root Origin, starting with the most immediate parent.
      参数:
      source - the source object or null
      返回:
      a list of parents or an empty list if the source is null, has no origin, or no parent