edu.nrao.sss.util
Class IllegalTransitionException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by edu.nrao.sss.util.IllegalTransitionException
All Implemented Interfaces:
Serializable

public class IllegalTransitionException
extends Exception

Thrown to indicate that an attempt to change a property from one value to another failed.

This exception is similar, but not quite the same as, java's IllegalArgumentException. One of the most appropriate places to use this exception is with status transitions of an object, especially when those transitions are the result of calling methods such as cancel() or execute(), as opposed to methods such as setStatus(newStatus).

The text returned by getMessage() will look like:

Property 'propertyName' may not be changed from 'currentValue' to 'illegalValue'.
or
Property 'propertyName' may not be changed from 'currentValue' to 'illegalValue'.  'additionalInformation'

Version Info:

$Revision: 2184 $
$Date: 2009-04-10 15:00:07 -0600 (Fri, 10 Apr 2009) $
$Author: dharland $ (last person to modify)

Since:
2007-08-17
Author:
David M. Harland
See Also:
Serialized Form

Constructor Summary
IllegalTransitionException(String propertyName, String currentValue, String illegalValue)
          Creates a new exception with the given properties.
IllegalTransitionException(String propertyName, String currentValue, String illegalValue, String additionalInformation)
          Creates a new exception with the given properties.
 
Method Summary
 String getAdditionalInformation()
          Returns any additional information about this transition.
 String getCurrentValue()
          Returns the value of the property prior to the attempt to change it.
 String getIllegalValue()
          Returns the value to which something tried to change the property.
 String getMessage()
           
 String getPropertyName()
          Returns the name of the property for which an illegal transistion was attempted.
 
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

IllegalTransitionException

public IllegalTransitionException(String propertyName,
                                  String currentValue,
                                  String illegalValue)
Creates a new exception with the given properties. See the class comments for a description of how the parameters are used to form a message.

This is a convenience constructor that is equivalent to IllegalTransitionException(propertyName, currentValue, illegalValue, "") .


IllegalTransitionException

public IllegalTransitionException(String propertyName,
                                  String currentValue,
                                  String illegalValue,
                                  String additionalInformation)
Creates a new exception with the given properties. See the class comments for a description of how the parameters are used to form a message.

Method Detail

getMessage

public String getMessage()
Overrides:
getMessage in class Throwable

getAdditionalInformation

public String getAdditionalInformation()
Returns any additional information about this transition. The additional information typically gives the reasons why the transition in question is deemed illegal.

If this exception carries no additional information, the empty string ("") will be returned.


getCurrentValue

public String getCurrentValue()
Returns the value of the property prior to the attempt to change it.


getIllegalValue

public String getIllegalValue()
Returns the value to which something tried to change the property.


getPropertyName

public String getPropertyName()
Returns the name of the property for which an illegal transistion was attempted.



Copyright © 2009. All Rights Reserved.