net.sf.oval
Class ConstraintViolation

java.lang.Object
  extended by net.sf.oval.ConstraintViolation
All Implemented Interfaces:
Serializable

public class ConstraintViolation
extends Object
implements Serializable

An instance of this class provides detailed information about a single constraint violation that occurred during validation.

Author:
Sebastian Thomschke
See Also:
Serialized Form

Constructor Summary
ConstraintViolation(Check check, String message, Object validatedObject, Object invalidValue, OValContext context)
           
ConstraintViolation(Check check, String message, Object validatedObject, Object invalidValue, OValContext context, ConstraintViolation... causes)
           
ConstraintViolation(Check check, String message, Object validatedObject, Object invalidValue, OValContext context, List<ConstraintViolation> causes)
           
 
Method Summary
 ConstraintViolation[] getCauses()
           
 OValContext getCheckDeclaringContext()
           
 String getCheckName()
           
 OValContext getContext()
           
 String getErrorCode()
           
 Object getInvalidValue()
           
 String getMessage()
           
 String getMessageTemplate()
           
 Map<String,? extends Serializable> getMessageVariables()
          Returns the message variables provided by the corresponding check.
 int getSeverity()
           
 Object getValidatedObject()
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstraintViolation

public ConstraintViolation(Check check,
                           String message,
                           Object validatedObject,
                           Object invalidValue,
                           OValContext context)

ConstraintViolation

public ConstraintViolation(Check check,
                           String message,
                           Object validatedObject,
                           Object invalidValue,
                           OValContext context,
                           ConstraintViolation... causes)

ConstraintViolation

public ConstraintViolation(Check check,
                           String message,
                           Object validatedObject,
                           Object invalidValue,
                           OValContext context,
                           List<ConstraintViolation> causes)
Method Detail

getCauses

public ConstraintViolation[] getCauses()
Returns:
the causes or null of no causes exists

getCheckDeclaringContext

public OValContext getCheckDeclaringContext()
Returns:
Returns the context where the constraint was declared.
See Also:
ClassContext, FieldContext, MethodEntryContext, MethodExitContext, MethodParameterContext, MethodReturnValueContext

getCheckName

public String getCheckName()
Returns:
the fully qualified class name of the corresponding check

getContext

public OValContext getContext()
Returns:
Returns the context where the constraint violation occurred.
See Also:
ClassContext, FieldContext, MethodEntryContext, MethodExitContext, MethodParameterContext, MethodReturnValueContext

getErrorCode

public String getErrorCode()
Returns:
the error code

getInvalidValue

public Object getInvalidValue()
Returns:
Returns the value that was validated.

getMessage

public String getMessage()
Returns:
the localized and rendered message

getMessageTemplate

public String getMessageTemplate()
Returns:
the raw message specified for the constraint without variable resolution and localization

getMessageVariables

public Map<String,? extends Serializable> getMessageVariables()
Returns the message variables provided by the corresponding check.

Returns:
an unmodifiable map holding the message variables provided by the corresponding check.

getSeverity

public int getSeverity()
Returns:
the severity

getValidatedObject

public Object getValidatedObject()
Returns:
the validatedObject

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2005–2013 The OVal Development Team. All rights reserved.