org.moyoman.module
Class ModuleName

java.lang.Object
  |
  +--org.moyoman.module.ModuleName
All Implemented Interfaces:
Serializable

public class ModuleName
extends Object
implements Serializable

This class represents a module name, e.g, org.moyoman.module.shape.shape1.Shape1. Every ModuleName object is associated with a ModuleType. Only one ModuleName object is instantiated per unique name. The static method getModuleName() is used to retrieve it.

See Also:
Serialized Form

Field Summary
private  String full
          The full name.
private static HashMap moduleNames
          The key is either the simple or full name, and the value is the ModuleName object.
private  String simple
          The simple name.
private  ModuleType type
          The ModuleType with which this object is associated.
 
Constructor Summary
protected ModuleName(String simpleName, String fullName, ModuleType moduleType)
          Create a new ModuleName object.
 
Method Summary
 boolean equals(Object o)
          Compare two objects for equality.
 String getFullName()
          Get the fully qualified name, e.g, org.moyoman.module.shape.shape1.Shape1.
static ModuleName getModuleName(String name)
          Get the ModuleName object for the given name.
 ModuleType getModuleType()
          Return the module type.
 String getSimpleName()
          The module name, e.g, Shape1.
 int hashCode()
          Get the hash code for this object.
 String toString()
          Return a string representation of this object.
 String typeAndNameString()
          Return a string of the form ModuleType : ModuleName.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

moduleNames

private static HashMap moduleNames
The key is either the simple or full name, and the value is the ModuleName object.


type

private ModuleType type
The ModuleType with which this object is associated.


simple

private String simple
The simple name.


full

private String full
The full name.

Constructor Detail

ModuleName

protected ModuleName(String simpleName,
                     String fullName,
                     ModuleType moduleType)
Create a new ModuleName object. Note that there is no intelligence or error checking here. Only the ModuleConfig class can create a ModuleName object, and it does all of the error checking on the arguments.

Parameters:
simpleName - The module name, e.g, Shape1,
fullName - The full module name, e.g, org.moyoman.module.shape.shape1.Shape1.
moduleType - The module type.
Method Detail

getFullName

public String getFullName()
Get the fully qualified name, e.g, org.moyoman.module.shape.shape1.Shape1.

Returns:
The fully qualified module name.

getSimpleName

public String getSimpleName()
The module name, e.g, Shape1.

Returns:
The module name.

getModuleType

public ModuleType getModuleType()
Return the module type.

Returns:
The module type.

getModuleName

public static ModuleName getModuleName(String name)
                                throws NoSuchDataException
Get the ModuleName object for the given name.

Parameters:
name - Either the simple or full name.
Returns:
A ModuleName object.
Throws:
NoSuchDataException - Thrown if there is no ModuleName object by that name.

hashCode

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

Overrides:
hashCode in class Object
Returns:
An int which is the hashcode.

equals

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

Overrides:
equals in class Object
Parameters:
o - The object being compared with this one.
Returns:
true if the objects are equal, or false.

typeAndNameString

public String typeAndNameString()
Return a string of the form ModuleType : ModuleName.

Returns:
A String representing this object.

toString

public String toString()
Return a string representation of this object.

Overrides:
toString in class Object
Returns:
A String which represents this object.