org.jboss.classloading.spi.metadata.helpers
Class AbstractRequirement

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

public class AbstractRequirement
extends NameAndVersionRangeSupport
implements Requirement

AbstractRequirement.

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

Constructor Summary
AbstractRequirement()
          Create a new AbstractRequirement
AbstractRequirement(String name)
          Create a new AbstractRequirement
AbstractRequirement(String name, VersionRange versionRange)
          Create a new AbstractRequirement.
 
Method Summary
 boolean equals(Object obj)
           
 boolean isConsistent(Requirement other)
          Check whether this requirement is consistent with another requirement.
protected  boolean isConsistent(Requirement other, Class<? extends AbstractRequirement> requirementType)
          Check whether the requirements are consistent
 boolean isDynamic()
          Whether the requirement is dynamic
 boolean isOptional()
          Whether the requirement is optional
 boolean isReExport()
          Whether to re-export the requirement
 void setDynamic(boolean dynamic)
          Set the dynamic.
 void setOptional(boolean optional)
          Set the optional.
 void setReExport(boolean reExport)
          Set the reExport.
 String toString()
           
protected  void toString(StringBuffer buffer)
          For subclasses to override toString()
 boolean wantReExports()
          Whether we want re-exports
 
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

AbstractRequirement

public AbstractRequirement()
Create a new AbstractRequirement


AbstractRequirement

public AbstractRequirement(String name)
Create a new AbstractRequirement

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

AbstractRequirement

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

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

isOptional

public boolean isOptional()
Description copied from interface: Requirement
Whether the requirement is optional

Specified by:
isOptional in interface Requirement
Returns:
true if the requirement is optional

setOptional

public void setOptional(boolean optional)
Set the optional.

Parameters:
optional - the optional.

isDynamic

public boolean isDynamic()
Description copied from interface: Requirement
Whether the requirement is dynamic

Specified by:
isDynamic in interface Requirement
Returns:
true if the requirement is dynamic

setDynamic

public void setDynamic(boolean dynamic)
Set the dynamic.

Parameters:
dynamic - the dynamic.

wantReExports

public boolean wantReExports()
Description copied from interface: Requirement
Whether we want re-exports

Specified by:
wantReExports in interface Requirement
Returns:
true to process re-exports

isReExport

public boolean isReExport()
Description copied from interface: Requirement
Whether to re-export the requirement

Specified by:
isReExport in interface Requirement
Returns:
true to re-export

setReExport

public void setReExport(boolean reExport)
Set the reExport.

Parameters:
reExport - the reExport.

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
Parameters:
other - the other requirement
Returns:
true when consistent, false when inconsistent

isConsistent

protected boolean isConsistent(Requirement other,
                               Class<? extends AbstractRequirement> requirementType)
Check whether the requirements are consistent

Parameters:
other - the other requirement
requirementType - the class to check when looking for inconsistencies (uses getClass() when null)
Returns:
true when consistent, false otherwise

equals

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

toString

public String toString()
Overrides:
toString in class NameAndVersionRangeSupport

toString

protected void toString(StringBuffer buffer)
For subclasses to override toString()

Parameters:
buffer - the buffer


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