SilverStream
Application Server 3.5

com.sssw.rt.util
Class AgoValidationException

java.lang.Object
 |
 +--java.lang.Throwable
       |
       +--java.lang.Exception
             |
             +--com.sssw.rt.util.AgoException
                   |
                   +--com.sssw.rt.util.AgoValidationException
All Implemented Interfaces:
AgiParentedException, Serializable

public class AgoValidationException
extends AgoException

Exception thrown by an AgiPropertyValidationListener.

See Also:
AgiPropertyValidationListener, Serialized Form

Field Summary
static int VALIDATION_FAIL
          Indicates that validation test has failed.
static int VALIDATION_SUCCEED
          Indicates that validation test succeeded.
 
Constructor Summary
AgoValidationException(int disposition)
          Deprecated. This constructor is deprecated. Use one of the static factory methods; they are more precise.
AgoValidationException(int disposition, String message, Object newValue)
          Deprecated. This constructor is deprecated. Use one of the static factory methods; they are more precise.
AgoValidationException(String message)
          Deprecated. This constructor is deprecated. Use one of the static factory methods; they are more precise.
 
Method Summary
static AgoValidationException correction(Object newValue)
          Static factory method which returns an exception indicating a successful validation by specifying a replacement (corrected) value.
static AgoValidationException failure()
          Static factory method which returns an exception indicating a validation failure with no associated message.
static AgoValidationException failure(String message)
          Static factory method which returns an exception indicating a validation failure with an associated message.
static AgoValidationException failure(String message, Object newValue)
          Static factory method which returns an exception indicating validation failure with an associated message and suggested new value.
 int getDisposition()
          Returns the disposition code of the exception.
 Object getNewValue()
          Retrieves the corrected value, if any, from the validation exception.
static AgoValidationException success()
          Static factory method which returns an exception indicating a successful validation with no new value.
 
Methods inherited from class com.sssw.rt.util.AgoException
copyTo, getExceptionHTML, getExceptionMessage, getExceptionMessage, getHTML, getMessage, getMessage, getParentException, printStackTrace, printStackTrace, printStackTrace, setHTML
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, printStackTrace, printStackTrace, printStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods implemented from interface com.sssw.rt.util.AgiParentedException
getExceptionParent
 

Field Detail

VALIDATION_FAIL

public static int VALIDATION_FAIL
Indicates that validation test has failed.

VALIDATION_SUCCEED

public static int VALIDATION_SUCCEED
Indicates that validation test succeeded.
Constructor Detail

AgoValidationException

public AgoValidationException(String message)
Deprecated. This constructor is deprecated. Use one of the static factory methods; they are more precise.

Parameters:
message - A message explaining the failure

AgoValidationException

public AgoValidationException(int disposition)
Deprecated. This constructor is deprecated. Use one of the static factory methods; they are more precise.

Parameters:
disposition - Specifies whether the validation succeeded or failed.

AgoValidationException

public AgoValidationException(int disposition,
                              String message,
                              Object newValue)
Deprecated. This constructor is deprecated. Use one of the static factory methods; they are more precise.

Parameters:
disposition - Specifies whether the validation succeeded or failed.
message - A validation error message. Used if the disposition indicates failure.
newValue - A replacement value. This new value is used instead of the proposed value, even if null.
Method Detail

failure

public static AgoValidationException failure()
Static factory method which returns an exception indicating a validation failure with no associated message.
Returns:
an AgoValidationException object.

failure

public static AgoValidationException failure(String message)
Static factory method which returns an exception indicating a validation failure with an associated message.
Parameters:
message - A message explaining the failure
Returns:
an AgoValidationException object.

failure

public static AgoValidationException failure(String message,
                                             Object newValue)
Static factory method which returns an exception indicating validation failure with an associated message and suggested new value.
Parameters:
message - A message explaining the failure
newValue - A suggested new value
Returns:
an AgoValidationException object.

success

public static AgoValidationException success()
Static factory method which returns an exception indicating a successful validation with no new value.
Returns:
AgoValidationException

correction

public static AgoValidationException correction(Object newValue)
Static factory method which returns an exception indicating a successful validation by specifying a replacement (corrected) value.
Parameters:
newValue - A new value for the control property. The value of this parameter is used even if null is passed.
Returns:
AgoValidationException

getNewValue

public Object getNewValue()
Retrieves the corrected value, if any, from the validation exception.
Returns:
the new value specified of this exception.
Example:
 	// Log that a correction has occurred
 	String corrected = (String)exc.getNewValue();
 	correctionLog.println("Value corrected to: "+corrected);
 
See Also:
AgoValidationException.getDisposition()

getDisposition

public int getDisposition()
Returns the disposition code of the exception.
Returns:
VALIDATION_FAIL or VALIDATION_SUCCEED.
Example:
 	int d = exc.getDisposition();
 
See Also:
AgoValidationException.getNewValue()

SilverStream
Application Server 3.5