issue #335 documentation improvements

This commit is contained in:
Crossy147
2016-02-19 19:08:35 +01:00
parent 3e526cb5da
commit 72e08365b8
5 changed files with 77 additions and 8 deletions

View File

@@ -8,11 +8,10 @@ public class User {
private String email;
/**
*
* @param name - name
* @param age - age
* @param sex - sex
* @param email - email
* @param name - name
* @param age - age
* @param sex - sex
* @param email - email address
*/
public User(String name, int age, Sex sex, String email) {
this.name = name;

View File

@@ -11,13 +11,22 @@ import java.util.function.Predicate;
* given object together step by step. In Validator each step results in either success or
* failure indicator, giving a way of receiving each of them easily and finally getting
* validated object or list of exceptions.
*
* @param <T> Placeholder for an object.
*/
public class Validator<T> {
/**
* Object that is validated
*/
private final T t;
/**
* List of exception thrown during validation.
*/
private final List<Throwable> exceptions = new ArrayList<>();
/**
* Creates a monadic value of given object.
* @param t object to be validated
*/
private Validator(T t) {
@@ -52,6 +61,7 @@ public class Validator<T> {
/**
* Extension for the {@link Validator#validate(Function, Predicate, String)} method,
* dedicated for objects, that need to be projected before requested validation.
*
* @param projection function that gets an objects, and returns projection representing
* element to be validated.
* @param validation see {@link Validator#validate(Function, Predicate, String)}
@@ -65,7 +75,7 @@ public class Validator<T> {
}
/**
* To receive validated object.
* Receives validated object or throws exception when invalid.
*
* @return object that was validated
* @throws IllegalStateException when any validation step results with failure