Class LinkTypeConstraint

  • All Implemented Interfaces:
    Constraint

    @Beta
    public class LinkTypeConstraint
    extends BooleanConstraint
    Constraint that evaluates links based on their type.
    • Constructor Detail

      • LinkTypeConstraint

        public LinkTypeConstraint​(boolean inclusive,
                                  Link.Type... types)
        Creates a new constraint for requesting connectivity using or avoiding the specified link types.
        Parameters:
        inclusive - indicates whether the given link types are to be permitted or avoided
        types - link types
    • Method Detail

      • isValid

        public boolean isValid​(Link link,
                               ResourceContext context)
        Description copied from class: BooleanConstraint
        Returns true if the specified link satisfies the constraint.
        Specified by:
        isValid in class BooleanConstraint
        Parameters:
        link - link to be validated
        context - resource context for checking available resources
        Returns:
        true if link is viable
      • types

        public Set<Link.Type> types()
        Returns the set of link types.
        Returns:
        set of link types
      • isInclusive

        public boolean isInclusive()
        Indicates if the constraint is inclusive or exclusive.
        Returns:
        true if inclusive
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object