org.jboss.classloading.plugins.metadata
Class PackageRequirement

java.lang.Object
  extended by org.jboss.classloading.spi.helpers.NameAndVersionRangeSupport
      extended by org.jboss.classloading.spi.metadata.helpers.AbstractRequirement
          extended by org.jboss.classloading.plugins.metadata.PackageRequirement
All Implemented Interfaces:
Serializable, OptionalPackages, Requirement
Direct Known Subclasses:
UsesPackageRequirement

public class PackageRequirement
extends AbstractRequirement
implements OptionalPackages

PackageRequirement.

Version:
$Revision: 1.1 $
Author:
Adrian Brock
See Also:
Serialized Form

Constructor Summary
PackageRequirement()
          Create a new PackageRequirement.
PackageRequirement(String name)
          Create a new PackageRequirement with no version constraint
PackageRequirement(String name, VersionRange versionRange)
          Create a new PackageRequirement.
 
Method Summary
 boolean equals(Object obj)
           
 Set<String> getOptionalPackageNames(Module module)
          Get the package names
 boolean isConsistent(Requirement other)
          Check whether this requirement is consistent with another requirement.
 
Methods inherited from class org.jboss.classloading.spi.metadata.helpers.AbstractRequirement
isConsistent, isDynamic, isOptional, isReExport, setDynamic, setOptional, setReExport, toString, toString, wantReExports
 
Methods inherited from class org.jboss.classloading.spi.helpers.NameAndVersionRangeSupport
getFrom, getFromVersion, getName, getTo, getToVersion, getVersionRange, hashCode, isFromVersionInclusive, isToVersionInclusive, setFrom, setFromVersion, setFromVersionInclusive, setName, setTo, setToVersion, setToVersionInclusive, setVersion, setVersionRange
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PackageRequirement

public PackageRequirement()
Create a new PackageRequirement.


PackageRequirement

public PackageRequirement(String name)
Create a new PackageRequirement with no version constraint

Parameters:
name - the name
Throws:
IllegalArgumentException - for a null name

PackageRequirement

public PackageRequirement(String name,
                          VersionRange versionRange)
Create a new PackageRequirement.

Parameters:
name - the name
versionRange - the version range - pass null for all versions
Throws:
IllegalArgumentException - for a null name
Method Detail

getOptionalPackageNames

public Set<String> getOptionalPackageNames(Module module)
Description copied from interface: OptionalPackages
Get the package names

Specified by:
getOptionalPackageNames in interface OptionalPackages
Parameters:
module - the module
Returns:
the package names

isConsistent

public boolean isConsistent(Requirement other)
Description copied from interface: Requirement
Check whether this requirement is consistent with another requirement.

Typically they will be inconsistent if they are the same type, have the same name but a different version

Specified by:
isConsistent in interface Requirement
Overrides:
isConsistent in class AbstractRequirement
Parameters:
other - the other requirement
Returns:
true when consistent, false when inconsistent

equals

public boolean equals(Object obj)
Overrides:
equals in class AbstractRequirement


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.