step.typedef
Class Package

java.lang.Object
  |
  +--step.typedef.Package

public class Package
extends Object

A STEP package.

Packages are unique objects.


Field Summary
static Package ROOT
          The "root" (global) package scope.
static String SEPARATOR
          The name separator for nested packages.
 
Method Summary
 boolean equals(Object o)
          Compare two packages for equality.
 String getFullName()
          Get the fully-qualified name of this package.
 String getName()
          Get the short name of this package.
 Package getParent()
          Get the parent of this package.
 int hashCode()
          Get the hash code for this package.
 String qualify(String baseName)
          Combine a package and a name to get a fully-qualified name.
 String toString()
           
static Package v(String name)
          Get the unique package with the given name.
static Package v(String name, Package parent)
          Get the unique package with the given name and parent.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SEPARATOR

public static final String SEPARATOR
The name separator for nested packages.

See Also:
Constant Field Values

ROOT

public static final Package ROOT
The "root" (global) package scope.

Method Detail

v

public static Package v(String name,
                        Package parent)
Get the unique package with the given name and parent. If the requested package does not exist, it is created.

Parameters:
name - the name of the package, which may be relative. Passing "x.y.z", "parent" gives "parent.x.y.z".
parent - the package that contains the requested name. The parent may be the ROOT package.

v

public static Package v(String name)
Get the unique package with the given name.

See Also:
v(String,Package)

getName

public String getName()
Get the short name of this package.

See Also:
getFullName()

getFullName

public String getFullName()
Get the fully-qualified name of this package. The form is, for example, "grandparent.parent.name".

See Also:
getName(), qualify(String)

qualify

public String qualify(String baseName)
Combine a package and a name to get a fully-qualified name.

Returns:
"pkg.baseName", or "baseName" if pkg equals ROOT.
See Also:
getFullName()

getParent

public Package getParent()
Get the parent of this package.

NOTE: The ROOT package has no parent.

Returns:
the parent package, or null if there is no parent.

equals

public boolean equals(Object o)
Compare two packages for equality.

Two packages are equal if they are the same object. This equality property is enforced by the creational pattern for packages.

Overrides:
equals in class Object
See Also:
v(String,Package)

hashCode

public int hashCode()
Get the hash code for this package.

Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object