java.module
Class ImportDependency

java.lang.Object
  extended by java.module.ImportDependency

public class ImportDependency
extends Object

This class represents an import dependency of the module definition.

Since:
1.7.0
Author:
Stanley M. Ho
See Also:
VersionConstraint

Constructor Summary
ImportDependency(String name, VersionConstraint constraint)
          Constructs a ImportDependency.
ImportDependency(String name, VersionConstraint constraint, boolean reexport, boolean optional)
          Constructs a ImportDependency.
 
Method Summary
 boolean equals(Object obj)
          Compare two ImportDependency objects for equality.
 String getModuleName()
          Returns the name of the imported module definition in an import dependency.
 VersionConstraint getVersionConstraint()
          Returns the version constraint of the import dependency.
 int hashCode()
          Returns a hash code for this ImportDependency.
 boolean isOptional()
          Returns true if the imported module definition is optional.
 boolean isReexported()
          Returns true if the imported module definition is re-exported.
 String toString()
          Returns a String object representing this ImportDependency.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImportDependency

public ImportDependency(String name,
                        VersionConstraint constraint)
Constructs a ImportDependency.

The imported module definition is assumed to be neither re-exported nor optional.

Parameters:
name - the name of the imported module definition.
constraint - the version constraint of the import dependency.
Throws:
NullPointerException - if name is null or constraint is null.

ImportDependency

public ImportDependency(String name,
                        VersionConstraint constraint,
                        boolean reexport,
                        boolean optional)
Constructs a ImportDependency.

Parameters:
name - the name of the imported module definition.
constraint - the version constraint of the import dependency.
reexport - true if the imported module definition is re-exported; otherwise, false.
optional - true if the imported module definition is optional; otherwise, false.
Throws:
NullPointerException - if name is null or constraint is null.
Method Detail

getModuleName

public String getModuleName()
Returns the name of the imported module definition in an import dependency.

Returns:
the name of the imported module definition.

getVersionConstraint

public VersionConstraint getVersionConstraint()
Returns the version constraint of the import dependency.

Returns:
the version constraint of the import dependency.

isReexported

public boolean isReexported()
Returns true if the imported module definition is re-exported. Otherwise, returns false.

Returns:
true if the imported module definition is re-exported; false otherwise.

isOptional

public boolean isOptional()
Returns true if the imported module definition is optional. Otherwise, returns false.

Returns:
true if the imported module definition is optional; false otherwise.

equals

public boolean equals(Object obj)
Compare two ImportDependency objects for equality. The result is true if and only if the argument is not null and is a ImportDependency object that imported module name, version constraint, reexport, and optional the same as those of this ImportDependency.

Overrides:
equals in class Object
Parameters:
obj - the object to compare with.
Returns:
whether or not the two objects are equal

hashCode

public int hashCode()
Returns a hash code for this ImportDependency.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.

toString

public String toString()
Returns a String object representing this ImportDependency.

Overrides:
toString in class Object
Returns:
a string representation of this object.