net.sf.mmm.util.value.api
Interface ValueValidator<V>

Type Parameters:
V - is the generic type of the value to validate.
All Known Subinterfaces:
PojoValidator
All Known Implementing Classes:
AbstractValueValidator, PojoValidatorDummy, ValueValidatorNotNull, ValueValidatorNumberRange

public interface ValueValidator<V>

A ValueValidator allows to validate according values.
There can be arbitrary implementations of this interface. A regular implementation shall be thread-safe.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Method Summary
 void validate(V value)
          This method validates the given value.
 void validate(V value, Object valueSource)
          This method validates the given value.
 

Method Detail

validate

void validate(V value)
              throws RuntimeException
This method validates the given value. If the value is invalid, a RuntimeException is thrown. Otherwise this method will return without any side-effect.

Parameters:
value - is the value to validate.
Throws:
RuntimeException - if the given value in invalid.

validate

void validate(V value,
              Object valueSource)
              throws RuntimeException
This method validates the given value. If the value is invalid, a RuntimeException is thrown. Otherwise this method will return without any side-effect.

Parameters:
value - is the value to validate.
valueSource - describes the origin of the given value. This may be the filename where the value was read from, an XPath where the value was located in an XML document, etc. It can be used in exceptions thrown if the value is invalid. This will help to find the problem easier. It may be null if there is no helpful source available but you should prefer validate(Object) in such case.
Throws:
RuntimeException - if the given value in invalid.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.