接口 Profiles

所有已知实现类:
ProfilesParser.ParsedProfiles
函数接口:
这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

@FunctionalInterface public interface Profiles
Profile predicate that may be accepted by an Environment.

May be implemented directly or, more usually, created using the of(...) factory method.

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

    修饰符和类型
    方法
    说明
    boolean
    matches(Predicate<String> isProfileActive)
    Test if this Profiles instance matches against the given predicate.
    static Profiles
    of(String... profileExpressions)
    Create a new Profiles instance that checks for matches against the given profile expressions.
  • 方法详细资料

    • matches

      boolean matches(Predicate<String> isProfileActive)
      Test if this Profiles instance matches against the given predicate.
      参数:
      isProfileActive - a predicate that tests whether a given profile is currently active
    • of

      static Profiles of(String... profileExpressions)
      Create a new Profiles instance that checks for matches against the given profile expressions.

      The returned instance will match if any one of the given profile expressions matches.

      A profile expression may contain a simple profile name (for example "production") or a compound expression. A compound expression allows for more complicated profile logic to be expressed, for example "production & cloud".

      The following operators are supported in profile expressions.

      • ! - A logical NOT of the profile name or compound expression
      • & - A logical AND of the profile names or compound expressions
      • | - A logical OR of the profile names or compound expressions

      Please note that the & and | operators may not be mixed without using parentheses. For example, "a & b | c" is not a valid expression: it must be expressed as "(a & b) | c" or "a & (b | c)".

      Two Profiles instances returned by this method are considered equivalent to each other (in terms of equals() and hashCode() semantics) if they are created with identical profile expressions.

      参数:
      profileExpressions - the profile expressions to include
      返回:
      a new Profiles instance