Class Capabilities


public final class Capabilities extends SimpleBuildItem
This build items holds the set of registered capabilities.
See Also:
  • Constructor Details

    • Capabilities

      public Capabilities(Set<String> capabilities)
  • Method Details

    • getCapabilities

      public Set<String> getCapabilities()
    • isCapabilityPresent

      @Deprecated public boolean isCapabilityPresent(String capability)
      Deprecated.
    • isPresent

      public boolean isPresent(String capability)
      Checks whether a given capability is present during the build.
      Parameters:
      capability - capability name
      Returns:
      true, in case the capability is present, otherwise - false
    • isMissing

      public boolean isMissing(String capability)
      Checks whether a given capability is missing during the build.
      Parameters:
      capability - capability name
      Returns:
      true, in case the capability is missing, otherwise - false
    • isCapabilityWithPrefixPresent

      public boolean isCapabilityWithPrefixPresent(String capabilityPrefix)
      Checks whether a capability with a given prefix is present during the build.

      A capability name is a dot-separated string. A prefix is also a string that is composed of either the first capability name element or a dot separated sequence of the capability name elements starting from the first one.

      E.g. for capability io.quarkus.resteasy.json.jackson the following prefixes will be registered:

      • io
      • io.quarkus
      • io.quarkus.resteasy
      • io.quarkus.resteasy.json
      And this method could be used to check whether a capability with prefix, e.g., io.quarkus.resteasy.json is present during the build.

      Given that only a single provider of a given capability is allowed in an application, capability prefixes allow expressing a certain common aspect among different but somewhat related capabilities.

      E.g. there could be extensions providing the following capabilities:

      • io.quarkus.resteasy.json.jackson
      • io.quarkus.resteasy.json.jackson.client
      • io.quarkus.resteasy.json.jsonb
      • io.quarkus.resteasy.json.jsonb.client
      Including any one of those extensions in an application will enable the RESTEasy JSON serializer. In case a build step needs to check whether the RESTEasy JSON serializer is already enabled in an application, instead of checking whether any of those capabilities is present, it could simply check whether an extension with prefix io.quarkus.resteasy.json is present.
      Parameters:
      capabilityPrefix - capability prefix
      Returns:
      true, in case the capability with the given prefix is present, otherwise - false
    • isCapabilityWithPrefixMissing

      public boolean isCapabilityWithPrefixMissing(String capabilityPrefix)
      Checks whether a capability with a given prefix is missing during the build. This method simple calls isCapabilityWithPrefixPresent(String) and returns its result inverted.
      Parameters:
      capabilityPrefix - capability prefix
      Returns:
      true, in case the capability with the given prefix is missing, otherwise - false