org.jcoderz.commons
Class FooString

java.lang.Object
  extended by org.jcoderz.commons.FooString
All Implemented Interfaces:
Serializable, Comparable, RestrictedString, StrongType

public final class FooString
extends Object
implements Serializable, RestrictedString, Comparable

Holds the FooString.

 String.type[1..10].
 
Instances of this class are immutable.

This class implements the Comparable interface based on the natural order of the String representation of its instances.

Author:
generated via stylesheet
See Also:
Serialized Form

Field Summary
static FooString CONSTANT_VALUE
          Additional Constant defined in the XML document.
static int MAX_LENGTH
          The maximal length of FooString (10).
static int MIN_LENGTH
          The minimal length of FooString (1).
static String TYPE_NAME
          FooString - the name of this type as string constant.
 
Method Summary
 int compareTo(Object o)
          Compares this FooString with an other.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
static FooString fromString(String str)
          Creates a FooString object from the String representation.
 int hashCode()
          Returns the hash code for the FooString.
 String toString()
          Returns the String representation of this FooString.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_NAME

public static final String TYPE_NAME
FooString - the name of this type as string constant.

See Also:
Constant Field Values

MIN_LENGTH

public static final int MIN_LENGTH
The minimal length of FooString (1).

See Also:
Constant Field Values

MAX_LENGTH

public static final int MAX_LENGTH
The maximal length of FooString (10).

See Also:
Constant Field Values

CONSTANT_VALUE

public static final FooString CONSTANT_VALUE
Additional Constant defined in the XML document.

Method Detail

fromString

public static FooString fromString(String str)
                            throws ArgumentMalformedException
Creates a FooString object from the String representation.

Parameters:
str - The str representation of the FooString to be returned.
Returns:
The FooString object represented by this str.
Throws:
ArgumentMalformedException - If the given string str violates the restriction of this type.

toString

public String toString()
Returns the String representation of this FooString.

Overrides:
toString in class Object
Returns:
The String representation of this FooString.

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
obj - the object to compare to.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Returns the hash code for the FooString.

Overrides:
hashCode in class Object
Returns:
the hash code for the FooString.

compareTo

public int compareTo(Object o)
Compares this FooString with an other. The order is based on the natural order of the String representation of the compared instances.

Specified by:
compareTo in interface Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type prevents it from being compared to this Object.
See Also:
String.compareTo(Object)


Copyright 2007 The jCoderZ Project.