org.oclc.da.gdfr.registryprototype.exceptions
Class RegistryException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.oclc.da.gdfr.registryprototype.exceptions.RegistryException
All Implemented Interfaces:
java.io.Serializable

public class RegistryException
extends java.lang.Exception

See Also:
Serialized Form

Constructor Summary
RegistryException()
          Construct a new exception with no message.
RegistryException(int code, java.lang.String[] args)
          Construct a new exception.
 
Method Summary
 void addMessage(int code, java.lang.String[] args)
          Add an additional message to the messages queue.
 int getErrorCode()
          Return the exception type code.
 java.lang.String getMessage()
          Return the exception messages as one string, each message separated by new-line and 2 tabs.
 java.lang.String[] getMessages()
          Return all the messages associated with this exception in an array.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RegistryException

public RegistryException()
Construct a new exception with no message. This constructor is only meaningful in the case where a single exception will hold multiple messages. The exception code is set to RegistryExceptionCodes.MULTIPLE.


RegistryException

public RegistryException(int code,
                         java.lang.String[] args)
Construct a new exception. The argument code must be declared in RegistryExceptionCodes.

Parameters:
code - A code identifying the type of exception. I must match one of the values in the list compiled by RegistryExceptionCodes.
args - The arguments for the message associated to code in RegistryExceptionCodes. Additional lines can be added to the message by calling addMessage.
Method Detail

addMessage

public void addMessage(int code,
                       java.lang.String[] args)
Add an additional message to the messages queue. This method is helpful in cases where multiple fields are validated at once, and hence more that one error may need to be reported, but only one exception should be thrown. The exception's error code is set to RegistryExceptionCodes.MULTIPLE.

Parameters:
code - A code identifying the type of exception. I must match one of the values in the list compiled by RegistryExceptionCodes.
args - The arguments for the message associated to code in RegistryExceptionCodes.

getErrorCode

public int getErrorCode()
Return the exception type code.

Returns:
The type code of this exception.

getMessage

public java.lang.String getMessage()
Return the exception messages as one string, each message separated by new-line and 2 tabs.

Overrides:
getMessage in class java.lang.Throwable
Returns:
The exception messages.

getMessages

public java.lang.String[] getMessages()
Return all the messages associated with this exception in an array.

Returns:
All the messages associated with this exception.


Copyright © 2008 OCLC Online Computer Library Center, Inc.. All Rights Reserved.