Class JdkVersionProfileActivator

java.lang.Object
org.apache.maven.model.profile.activation.JdkVersionProfileActivator
All Implemented Interfaces:
ProfileActivator

@Named("jdk-version") @Singleton public class JdkVersionProfileActivator extends Object implements ProfileActivator
Determines profile activation based on the version of the current Java runtime.
See Also:
  • Field Details

    • FILTER_1

      private static final Pattern FILTER_1
    • FILTER_2

      private static final Pattern FILTER_2
    • FILTER_3

      private static final Pattern FILTER_3
  • Constructor Details

    • JdkVersionProfileActivator

      public JdkVersionProfileActivator()
  • Method Details

    • isActive

      public boolean isActive(Profile profile, ProfileActivationContext context, ModelProblemCollector problems)
      Description copied from interface: ProfileActivator
      Determines whether the specified profile is active in the given activator context.
      Specified by:
      isActive in interface ProfileActivator
      Parameters:
      profile - The profile whose activation status should be determined, must not be null.
      context - The environmental context used to determine the activation status of the profile, must not be null.
      problems - The container used to collect problems (e.g. bad syntax) that were encountered, must not be null.
      Returns:
      true if the profile is active, false otherwise.
    • presentInConfig

      public boolean presentInConfig(Profile profile, ProfileActivationContext context, ModelProblemCollector problems)
      Description copied from interface: ProfileActivator
      Determines whether specified activation method is present in configuration or not. It should help to have AND between activation conditions Need for solving https://issues.apache.org/jira/browse/MNG-4565
      Specified by:
      presentInConfig in interface ProfileActivator
      Parameters:
      profile - The profile whose activation status should be determined, must not be null.
      context - The environmental context used to determine the activation status of the profile, must not be null.
      problems - The container used to collect problems (e.g. bad syntax) that were encountered, must not be null.
      Returns:
      true if the profile is active, false otherwise.
    • isInRange

      private static boolean isInRange(String value, List<JdkVersionProfileActivator.RangeValue> range)
    • getRelationOrder

      private static int getRelationOrder(String value, JdkVersionProfileActivator.RangeValue rangeValue, boolean isLeft)
    • addZeroTokens

      private static void addZeroTokens(List<String> tokens, int max)
    • isRange

      private static boolean isRange(String value)
    • getRange

      private static List<JdkVersionProfileActivator.RangeValue> getRange(String range)