Interface CapabilityService


  • public interface CapabilityService
    Service for figuring out provided API capabilities.

    registerEnableListener(Consumer) to be notified of Plan reloads hasCapability(String) to check if a capability is available.

    See Capability for list of capabilities provided by the current version.

    • Method Detail

      • getInstance

        static CapabilityService getInstance()
        Obtain instance of CapabilityService.
        Returns:
        CapabilityService implementation.
        Throws:
        java.lang.NoClassDefFoundError - If Plan is not installed and this class can not be found or if older Plan version is installed.
        java.lang.IllegalStateException - If Plan is installed, but not enabled.
      • registerEnableListener

        default void registerEnableListener​(java.util.function.Consumer<java.lang.Boolean> isEnabledListener)
        Register a method to be called when Plan reloads.
        Parameters:
        isEnabledListener - The boolean given to the method tells if Plan has enabled successfully.
      • hasCapability

        default boolean hasCapability​(java.lang.String capabilityName)
        Check if the API on the current version provides a capability.
        Parameters:
        capabilityName - Name of a capability
        Returns:
        true if the capability is available.
        See Also:
        for different capabilityNames.