Interface Profiles

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@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.

Since:
7.5.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    matches(Predicate<String> isProfileActive)
    Test if this Profiles instance matches against the given predicate.
    static Profiles
    of(String profileExpression)
    Create a new Profiles instance that checks for matches against the given profile expressions.
  • Method Details

    • matches

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

      @NonNull static Profiles of(String profileExpression)
      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 set of them
      • , - A delimiter to separate profile names or sets of them

      The following parentheses are used for compound expressions:

      • () - A logical AND operation is applied to all profile names enclosed by this; aka AND set
      • [] - A logical OR operation is applied to all profile names enclosed by this; aka OR set, it can be omitted in compound expressions that have only one OR set.
      Parameters:
      profileExpression - the expression for profiles to include or exclude
      Returns:
      a new Profiles instance