org.moyoman.module
Class ModuleType

java.lang.Object
  |
  +--org.moyoman.module.ModuleType
All Implemented Interfaces:
ComponentType, Serializable

public class ModuleType
extends Object
implements ComponentType, Serializable

This class represents a module type, e.g, Shape. There is only one object instantiated for each module type. The static getModuleType() method is used to retrieve it. This class is implemented this way because otherwise there could be conceivably thousands of extra objects instantiated which would serve no useful purpose.

See Also:
Serialized Form

Field Summary
private  String full
          The full name, e.g, org.moyoman.module.shape.Shape
private static HashMap hm
          The key is the simple name or full name, the value is the ModuleType object.
private  String simple
          The simple name, e.g, Shape.
 
Constructor Summary
protected ModuleType(String s, String f)
          Create the ModuleType object without any error checking.
 
Method Summary
 boolean equals(Object o)
          Compare this object with another one for equality.
 String getFullName()
          Return the full type, e.g, org.moyoman.module.shape.Shape.
static ModuleType getModuleType(String type)
          Create the ModuleType object.
 String getSimpleName()
          Return the interface name, e.g, Shape.
 int hashCode()
          Get a hash code for the object.
 String toString()
          Return a representation of this object as a String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

hm

private static HashMap hm
The key is the simple name or full name, the value is the ModuleType object.


simple

private String simple
The simple name, e.g, Shape.


full

private String full
The full name, e.g, org.moyoman.module.shape.Shape

Constructor Detail

ModuleType

protected ModuleType(String s,
                     String f)
Create the ModuleType object without any error checking. This would be used by ModuleConfig when a new ModuleType is being created, and so error checking could not be done.

Parameters:
s - The simple module type name
f - The full module type name.
Method Detail

getModuleType

public static ModuleType getModuleType(String type)
                                throws NoSuchDataException
Create the ModuleType object.

Parameters:
type - The name of the type. Shape, or org.moyoman.module.shape.Shape are acceptable.
Throws:
NoSuchDataException - Thrown if there is no corresponding module type.

getFullName

public String getFullName()
Return the full type, e.g, org.moyoman.module.shape.Shape.

Returns:
The full type name.

getSimpleName

public String getSimpleName()
Return the interface name, e.g, Shape.

Returns:
The interface name.

hashCode

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

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

equals

public boolean equals(Object o)
Compare this object with another one for equality.

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

toString

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

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