Class MeteredConstraint

  • All Implemented Interfaces:
    Constraint

    @Beta
    public class MeteredConstraint
    extends BooleanConstraint
    Constraint that evaluates links based on the metered flag.
    • Constructor Summary

      Constructors 
      Constructor Description
      MeteredConstraint​(boolean metered)
      Creates a new constraint for requesting connectivity using or avoiding the metered links.
    • Constructor Detail

      • MeteredConstraint

        public MeteredConstraint​(boolean metered)
        Creates a new constraint for requesting connectivity using or avoiding the metered links.
        Parameters:
        metered - indicates whether a metered link can be used.
    • 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
      • isUseMetered

        public boolean isUseMetered()
        Indicates if the constraint is metered or not.
        Returns:
        true if metered
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object