ninja.validation
Interface Validation

All Known Implementing Classes:
ValidationImpl

public interface Validation

Validation context

Author:
James Roper

Method Summary
 void addFieldViolation(String field, ConstraintViolation constraintViolation)
          Add a violation to the given field
 void addViolation(ConstraintViolation constraintViolation)
          Add a general violation
 ConstraintViolation getFieldViolation(String field)
          Get the voilation for the given field
 String getFieldViolationMessage(String field)
          Get the formatted violation message for the given field
 String getFieldViolationMessage(String field, Locale locale)
          Get the formatted violation message for the given field
 boolean hasFieldViolation(String field)
          Whether the validation context has a violation for the given field
 boolean hasViolations()
          Whether the validation context has violations
 

Method Detail

hasViolations

boolean hasViolations()
Whether the validation context has violations

Returns:
True if it does

hasFieldViolation

boolean hasFieldViolation(String field)
Whether the validation context has a violation for the given field

Returns:
True if it does

addFieldViolation

void addFieldViolation(String field,
                       ConstraintViolation constraintViolation)
Add a violation to the given field

Parameters:
field - The field to add the violation to
constraintViolation - The constraint violation

addViolation

void addViolation(ConstraintViolation constraintViolation)
Add a general violation

Parameters:
constraintViolation - The constraint violation

getFieldViolation

ConstraintViolation getFieldViolation(String field)
Get the voilation for the given field

Parameters:
field - The field
Returns:
The constraint violation, or null if no constraint violation was found

getFieldViolationMessage

String getFieldViolationMessage(String field)
Get the formatted violation message for the given field

Parameters:
field - The field
Returns:
The message, or null if there was no violation

getFieldViolationMessage

String getFieldViolationMessage(String field,
                                Locale locale)
Get the formatted violation message for the given field

Parameters:
field - The field
locale - The locale
Returns:
The message, or null if there was no violation


Copyright © 2012. All Rights Reserved.