Class PackageConstraint

  • Direct Known Subclasses:
    VersionPackageConstraint, VersionRangePackageConstraint

    public abstract class PackageConstraint
    extends java.lang.Object
    Abstract base class for package constraints. An example implementation might be to encapsulate a constraint with respect to a version number. Checking against a target in this case would typically assume the same package for both this and the target.
    Version:
    $Revision: 44030 $
    Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
    • Constructor Detail

      • PackageConstraint

        public PackageConstraint()
    • Method Detail

      • setPackage

        public void setPackage​(Package p)
        Set the package that this constraint applies to.
        Parameters:
        p - the package that this constraint applies to.
      • getPackage

        public Package getPackage()
        Get the package that this constraint applies to.
        Returns:
        the Package that this constraint applies to.
      • checkConstraint

        public abstract boolean checkConstraint​(Package target)
                                         throws java.lang.Exception
        Check the target package against the constraint embodied in this PackageConstraint.
        Parameters:
        target - a package to check with respect to the encapsulated package and the constraint.
        Returns:
        true if the constraint is met by the target package with respect to the encapsulated package + constraint.
        Throws:
        java.lang.Exception - if the constraint can't be checked for some reason.
      • checkConstraint

        public abstract PackageConstraint checkConstraint​(PackageConstraint target)
                                                   throws java.lang.Exception
        Check the target package constraint against the constraint embodied in this package constraint. Returns either the package constraint that covers both this and the target constraint, or null if this and the target are incompatible.
        Parameters:
        target - the package constraint to compare against
        Returns:
        a package constraint that covers this and the supplied constraint, or null if they are incompatible.
        Throws:
        java.lang.Exception