// Path: src/main/java/com/github/brunodles/javavalidation/matcher/When.java
// public class When {
// 
//     private IntConsumer adder;
// 
//     public When(IntConsumer adder) {
//         this.adder = adder;
//     }
// 
//     /**
//      * @param value a String to be the reference value
//      * @return a {@link StringMatcher}
//      */
//     public StringMatcher when(String value) {
//         return new StringMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Integer to be the reference value
//      * @return a {@link IntegerMatcher}
//      */
//     public IntegerMatcher when(Integer value) {
//         return new IntegerMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Long to be the reference value
//      * @return a {@link LongMatcher}
//      */
//     public LongMatcher when(Long value) {
//         return new LongMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Float to be the reference value
//      * @return a {@link FloatMatcher}
//      */
//     public FloatMatcher when(Float value) {
//         return new FloatMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Double to be the reference value
//      * @return a {@link DoubleMatcher}
//      */
//     public DoubleMatcher when(Double value) {
//         return new DoubleMatcher(value, adder);
//     }
// 
//     /**
//      * @param object a Object to be the reference value
//      * @param <T>    Don't need to worry with this parameter it will be auto inferred by compiler
//      * @return a {@link ObjectMatcher}
//      */
//     public <T> ObjectMatcher<T, ?> when(final T object) {
//         return new ObjectMatcherImpl<T>(object, adder);
//     }
// }
// 
// Path: src/main/java/com/github/brunodles/retrofunctions/IntConsumer.java
// @FunctionalInterface
// public interface IntConsumer {
// 
//     /**
//      * Performs this operation on the given argument.
//      *
//      * @param value the input argument
//      */
//     void accept(int value);
// 
// }


import com.github.brunodles.javavalidation.matcher.When;
import com.github.brunodles.retrofunctions.IntConsumer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
package com.github.brunodles.javavalidation;



/**
 * This builder will be used inside the validator to create all validations.
 * Created by bruno on 03/06/16.
 */
public class ValidationResultBuilder implements ValidationResult {
    HashMap<String, Integer> errorMap;

    public ValidationResultBuilder() {
        errorMap = new HashMap<>();
    }

    /**
     * Use this method to add an error.
     *
     * @param key   This key will be used to know what is wrong, you ca use the field name here.
     * @param error All errors are constants, use one of {@link Errors}
     */
    public void add(String key, int error) {
        Integer errors = errorsFrom(key);
        errors |= error;
        errorMap.put(key, errors);
    }

    /**
     * This will return one error adder for the key
     *
     * @param key the key you want to add error
     * @return a {@link IntConsumer}, to add errors on the key just call {@link IntConsumer#accept(int)}
     */
// Path: src/main/java/com/github/brunodles/javavalidation/matcher/When.java
// public class When {
// 
//     private IntConsumer adder;
// 
//     public When(IntConsumer adder) {
//         this.adder = adder;
//     }
// 
//     /**
//      * @param value a String to be the reference value
//      * @return a {@link StringMatcher}
//      */
//     public StringMatcher when(String value) {
//         return new StringMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Integer to be the reference value
//      * @return a {@link IntegerMatcher}
//      */
//     public IntegerMatcher when(Integer value) {
//         return new IntegerMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Long to be the reference value
//      * @return a {@link LongMatcher}
//      */
//     public LongMatcher when(Long value) {
//         return new LongMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Float to be the reference value
//      * @return a {@link FloatMatcher}
//      */
//     public FloatMatcher when(Float value) {
//         return new FloatMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Double to be the reference value
//      * @return a {@link DoubleMatcher}
//      */
//     public DoubleMatcher when(Double value) {
//         return new DoubleMatcher(value, adder);
//     }
// 
//     /**
//      * @param object a Object to be the reference value
//      * @param <T>    Don't need to worry with this parameter it will be auto inferred by compiler
//      * @return a {@link ObjectMatcher}
//      */
//     public <T> ObjectMatcher<T, ?> when(final T object) {
//         return new ObjectMatcherImpl<T>(object, adder);
//     }
// }
// 
// Path: src/main/java/com/github/brunodles/retrofunctions/IntConsumer.java
// @FunctionalInterface
// public interface IntConsumer {
// 
//     /**
//      * Performs this operation on the given argument.
//      *
//      * @param value the input argument
//      */
//     void accept(int value);
// 
// }


// Path: src/main/java/com/github/brunodles/javavalidation/ValidationResultBuilder.java
import com.github.brunodles.javavalidation.matcher.When;
import com.github.brunodles.retrofunctions.IntConsumer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

package com.github.brunodles.javavalidation;



/**
 * This builder will be used inside the validator to create all validations.
 * Created by bruno on 03/06/16.
 */
public class ValidationResultBuilder implements ValidationResult {
    HashMap<String, Integer> errorMap;

    public ValidationResultBuilder() {
        errorMap = new HashMap<>();
    }

    /**
     * Use this method to add an error.
     *
     * @param key   This key will be used to know what is wrong, you ca use the field name here.
     * @param error All errors are constants, use one of {@link Errors}
     */
    public void add(String key, int error) {
        Integer errors = errorsFrom(key);
        errors |= error;
        errorMap.put(key, errors);
    }

    /**
     * This will return one error adder for the key
     *
     * @param key the key you want to add error
     * @return a {@link IntConsumer}, to add errors on the key just call {@link IntConsumer#accept(int)}
     */
    public IntConsumer adder(String key) {