FileDocCategorySizeDatePackage
CustomerID.javaAPI DocExample2706Thu Oct 13 14:57:34 BST 2005com.samscdrental.model.adt

CustomerID

public class CustomerID extends Object implements Serializable

Title: Sams CD Rental Store

Description:

Copyright: Copyright (c) 2004

Company:

author
Ken Pugh
version
1.0

Fields Summary
private static final long
serialVersionUID
private String
theValue
private static final String
INVALID_ID
private static final int
LENGTH_OF_VALUE
private static final String
ERROR_CUSTOMER_ID_BAD_LENGTH
private static final String
ERROR_CUSTOMER_ID_BAD_CHARACTERS
Constructors Summary
public CustomerID()

 

	 
	

	
public CustomerID(String aString)

		fromString( aString );

	
Methods Summary
public booleanequals(com.samscdrental.model.adt.CustomerID aCustomerID)
Indicates whether some other object is "equal to" this one.

param
obj the reference object with which to compare.
return
true if this object is the same as the obj argument; false otherwise.
todo
Implement this java.lang.Object method

		return theValue.equals( aCustomerID.theValue );
	
public booleanequals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

param
obj the reference object with which to compare.
return
true if this object is the same as the obj argument; false otherwise.
todo
Implement this java.lang.Object method

		return equals( ( CustomerID ) obj );
	
public voidfromString(java.lang.String aString)
fromString

param
aString String
return
boolean

		if ( aString.length() == LENGTH_OF_VALUE )
		{
			if ( !StringHelper.containsOnlyAlphanumerics( aString ) )
			{
				throw new CustomerIDFormatDeviation(
					ERROR_CUSTOMER_ID_BAD_CHARACTERS );
			}

			theValue = aString;
		}
		else
		{

			throw new CustomerIDFormatDeviation( ERROR_CUSTOMER_ID_BAD_LENGTH );
		}
	
booleanisInvalid()

		return theValue.equals( INVALID_ID );
	
public static com.samscdrental.model.adt.CustomerIDparseString(java.lang.String aString)

		return new CustomerID( aString );
	
public java.lang.StringtoString()
Returns a string representation of the object.

return
a string representation of the object.

		return theValue;