Class CapabilityRequirement


  • public class CapabilityRequirement
    extends Object
    Represents a requirement that a set of capabilities must meet.
    Author:
    Corey Sterling (csterlin at waikato dot ac dot nz)
    • Field Detail

      • NON_HANDLER_CAPABILITIES

        public static final ImmutableCapabilities NON_HANDLER_CAPABILITIES
        The capabilities to assume a class has if it does not implement the CapabilitiesHandler interface.
    • Constructor Detail

      • CapabilityRequirement

        public CapabilityRequirement​(java.util.function.Predicate<Capabilities> check)
        Creates a capabilities requirement with the given predicate as its method of checking if the requirement is met.
        Parameters:
        check - The test for adherence.
    • Method Detail

      • isMetBy

        public boolean isMetBy​(Capabilities capabilities)
        Tests if the requirement is met by the given set of capabilities.
        Parameters:
        capabilities - The set of capabilities to test.
        Returns:
        True if the requirement is met, false if not.
      • isMetBy

        public boolean isMetBy​(CapabilitiesHandler handler)
        Tests if the requirement is met by the given capabilities handler.
        Parameters:
        handler - The handler to test.
        Returns:
        True if the handler meets the requirements, false if not.
      • isMetBy

        public boolean isMetBy​(Class<?> klass)
        Tests if the requirement is met by the given class.
        Parameters:
        klass - The class to test.
        Returns:
        True if the class meets the requirements, false if not.
      • or

        public CapabilityRequirement or​(CapabilityRequirement other)
        Creates a requirement which is the logical OR of this and the given requirement.
        Parameters:
        other - The other operand to the OR.
        Returns:
        The resulting requirement.
      • hasAll

        public static CapabilityRequirement hasAll​(Capability... capabilities)
        Creates a requirement that a given set of capabilities have all of the specified capabilities.
        Parameters:
        capabilities - The capabilities that a tested set must have.
        Returns:
        The requirement.
      • hasAny

        public static CapabilityRequirement hasAny​(Capability... capabilities)
        Creates a requirement that a given set of capabilities have at least on of the specified capabilities.
        Parameters:
        capabilities - The capabilities that a tested set must have at least one of.
        Returns:
        The requirement.
      • has

        public static CapabilityRequirement has​(Capability capability)
        Creates a requirement that a given set of capabilities must have the given capability.
        Parameters:
        capability - The capability a tested set must have.
        Returns:
        The requirement.