// Path: inputvalidation/src/main/java/com/switchfly/inputvalidation/canonicalizer/Canonicalizer.java
// public interface Canonicalizer<O> {
// 
//     O execute(O content);
// }
// 
// Path: inputvalidation/src/main/java/com/switchfly/inputvalidation/exception/ValidatorException.java
// public class ValidatorException extends RuntimeException {
//     private static final long serialVersionUID = 1L;
//     private final String _sanitizedContent;
// 
//     public ValidatorException(String sanitizedContent) {
//         _sanitizedContent = sanitizedContent;
//     }
// 
//     public ValidatorException(String sanitizedContent, String message) {
//         super(message);
//         _sanitizedContent = sanitizedContent;
//     }
// 
//     public String getSanitizedContent() {
//         return _sanitizedContent;
//     }
// }
// 
// Path: inputvalidation/src/main/java/com/switchfly/inputvalidation/sanitizer/Sanitizer.java
// public interface Sanitizer<O> {
// 
//     O execute(O content);
// }
// 
// Path: inputvalidation/src/main/java/com/switchfly/inputvalidation/validator/Validator.java
// public abstract class Validator<O> {
// 
//     private String _errorMessage;
// 
//     public abstract boolean execute(O content);
// 
//     public String getErrorMessage() {
//         return _errorMessage;
//     }
// 
//     public void setErrorMessage(String errorMessage) {
//         _errorMessage = errorMessage;
//     }
// }


import com.switchfly.inputvalidation.canonicalizer.Canonicalizer;
import com.switchfly.inputvalidation.exception.ValidatorException;
import com.switchfly.inputvalidation.sanitizer.Sanitizer;
import com.switchfly.inputvalidation.validator.Validator;
import org.apache.commons.lang.StringUtils;
    public static final ValidationStrategies NAME = ValidationStrategyBuilder.withPattern("[\\p{L}\\p{Nd}_\\.\\-\\s~,'`]+");
    public static final ValidationStrategies PROPERTY_NAME = ValidationStrategyBuilder.withPattern("[\\w\\d\\-\\._]+");

    private final Canonicalizer<O> _canonicalizer;
    private final Validator<O> _validator;
    private final Sanitizer<O> _sanitizer;

    public ValidationStrategy(Canonicalizer<O> canonicalizer, Validator<O> validator, Sanitizer<O> sanitizer) {
        _canonicalizer = canonicalizer;
        _validator = validator;
        _sanitizer = sanitizer;
    }

    public final Canonicalizer<O> getCanonicalizer() {
        return _canonicalizer;
    }

    public final Validator<O> getValidator() {
        return _validator;
    }

    public final Sanitizer<O> getSanitizer() {
        return _sanitizer;
    }

    public final O validate(O content) {
        O canonicalized = null;
        try {
            canonicalized = _canonicalizer != null ? _canonicalizer.execute(content) : content;
        } catch (Exception e) {
// Path: inputvalidation/src/main/java/com/switchfly/inputvalidation/canonicalizer/Canonicalizer.java
// public interface Canonicalizer<O> {
// 
//     O execute(O content);
// }
// 
// Path: inputvalidation/src/main/java/com/switchfly/inputvalidation/exception/ValidatorException.java
// public class ValidatorException extends RuntimeException {
//     private static final long serialVersionUID = 1L;
//     private final String _sanitizedContent;
// 
//     public ValidatorException(String sanitizedContent) {
//         _sanitizedContent = sanitizedContent;
//     }
// 
//     public ValidatorException(String sanitizedContent, String message) {
//         super(message);
//         _sanitizedContent = sanitizedContent;
//     }
// 
//     public String getSanitizedContent() {
//         return _sanitizedContent;
//     }
// }
// 
// Path: inputvalidation/src/main/java/com/switchfly/inputvalidation/sanitizer/Sanitizer.java
// public interface Sanitizer<O> {
// 
//     O execute(O content);
// }
// 
// Path: inputvalidation/src/main/java/com/switchfly/inputvalidation/validator/Validator.java
// public abstract class Validator<O> {
// 
//     private String _errorMessage;
// 
//     public abstract boolean execute(O content);
// 
//     public String getErrorMessage() {
//         return _errorMessage;
//     }
// 
//     public void setErrorMessage(String errorMessage) {
//         _errorMessage = errorMessage;
//     }
// }


// Path: inputvalidation/src/main/java/com/switchfly/inputvalidation/ValidationStrategy.java
import com.switchfly.inputvalidation.canonicalizer.Canonicalizer;
import com.switchfly.inputvalidation.exception.ValidatorException;
import com.switchfly.inputvalidation.sanitizer.Sanitizer;
import com.switchfly.inputvalidation.validator.Validator;
import org.apache.commons.lang.StringUtils;

    public static final ValidationStrategies NAME = ValidationStrategyBuilder.withPattern("[\\p{L}\\p{Nd}_\\.\\-\\s~,'`]+");
    public static final ValidationStrategies PROPERTY_NAME = ValidationStrategyBuilder.withPattern("[\\w\\d\\-\\._]+");

    private final Canonicalizer<O> _canonicalizer;
    private final Validator<O> _validator;
    private final Sanitizer<O> _sanitizer;

    public ValidationStrategy(Canonicalizer<O> canonicalizer, Validator<O> validator, Sanitizer<O> sanitizer) {
        _canonicalizer = canonicalizer;
        _validator = validator;
        _sanitizer = sanitizer;
    }

    public final Canonicalizer<O> getCanonicalizer() {
        return _canonicalizer;
    }

    public final Validator<O> getValidator() {
        return _validator;
    }

    public final Sanitizer<O> getSanitizer() {
        return _sanitizer;
    }

    public final O validate(O content) {
        O canonicalized = null;
        try {
            canonicalized = _canonicalizer != null ? _canonicalizer.execute(content) : content;
        } catch (Exception e) {
            throw new ValidatorException("", "Failed to canonicalize content.");