// Path: src/main/java/de/jformchecker/criteria/ValidationResult.java
// public class ValidationResult {
// 
// 	boolean isValid = false;
// 	
// 	// caching:
// 	private static ValidationResult okResult =  new ValidationResult(true, "", null, null);
// 
// 	public boolean isValid() {
// 		return isValid;
// 	}
// 
// 	public String getMessage() {
// 		return message;
// 	}
// 
// 	public Object[] getErrorVals() {
// 		return errorVals;
// 	}
// 
// 	String message;
// 	String translatedMessage;
// 	Object[] errorVals;
// 
// 	public ValidationResult(boolean isValid, String message, Object[] errorVals, String translatedMessage) {
// 		this.isValid = isValid;
// 		this.message = message;
// 		this.errorVals = errorVals;
// 		this.translatedMessage = translatedMessage;
// 	}
// 
// 	// factory methods
// 	public static ValidationResult of_(boolean isValid, String message, Object... errorVals) {
// 		return new ValidationResult(isValid, message, errorVals, null);
// 	}
// 
// 	public static ValidationResult fail(String message, Object... errorVals) {
// 		return new ValidationResult(false, message, errorVals, null);
// 	}
// 
// 	public static ValidationResult failWithTranslated(String message, Object... errorVals) {
// 		return new ValidationResult(false, null, errorVals, message);
// 	}
// 
// 	public static ValidationResult failWithTranslated(String message) {
// 		return new ValidationResult(false, null, new Object[0], message);
// 	}
// 	
// 	public static ValidationResult ok() {
// 		// RFE: Could return always the same object! will reduce memory
// 		// footprint!
// 		return okResult;
// 	}
// 
// 	public String getTranslatedMessage() {
// 		return translatedMessage;
// 	}
// 
// }
// 
// Path: src/main/java/de/jformchecker/message/MessageSource.java
// @FunctionalInterface
// public interface MessageSource {
// 
// 	public String getMessage(String key);
// 
// 	public default String getSafeMessage(String key) {
// 		try {
// 			String msg = this.getMessage(key);
// 			return msg;
// 		} catch (Exception e) {
// 			return "??" + key + "??";
// 		}
// 	}
// 
// 	
// 	public default String getMessage(ValidationResult vr) {
// 		// give translated messages higher prio than message-keys
// 		if (vr.getTranslatedMessage() != null) {
// 			return vr.getTranslatedMessage();
// 		} else 
// 		if (vr.getMessage() != null) {
// 			return(String.format(this.getSafeMessage(
// 					vr.getMessage()
// 					), vr.getErrorVals()));
// 			
// 		} else {
// 			throw new IllegalArgumentException("ValidationResult has neither message-key nor translated text");
// 		}
// 	}
// 
// }
// 
// Path: src/main/java/de/jformchecker/request/Request.java
// @FunctionalInterface
// public interface Request {
// 	public String getParameter(String name);
// }
// 
// Path: src/main/java/de/jformchecker/validator/Validator.java
// public interface Validator {
// 
// 	ValidationResult validate(FormCheckerElement elem);
// 
// }


import java.util.List;
import java.util.Map;
import de.jformchecker.criteria.ValidationResult;
import de.jformchecker.message.MessageSource;
import de.jformchecker.request.Request;
import de.jformchecker.validator.Validator;
package de.jformchecker;



/**
 * Interface for Input-Elements handled by formchecker
 * 
 * @author jochen
 *
 */
public interface FormCheckerElement {

	// RFE: check, if some methods can be protected

	// get internal name of this input-element
	public String getName();
	
	// set internal name
	public void setName(String name);


	// get the value that the user entered
	public String getValue();

	// get the value that the user entered, but html-encoded
	@Deprecated
	public String getValueHtmlEncoded();

	public void setValue(String value);

	public String getPreSetValue();

	// set an initial value to the element, before the user edited it.
	public <T extends FormCheckerElement> T setPreSetValue(String value);

	public <T extends FormCheckerElement> T setTabIndex(int tabIndex);

	public int getTabIndex();

	public int getLastTabIndex();

	// set the test in the label (builder pattern)
	
	public <T extends FormCheckerElement> T setDescription(String desc);

	// as "setDescription" but does not return anything (no builder pattern)
	public void changeDescription(String desc);

	public String getDescription();

	// returns true if element is valid
	public boolean isValid();

	public void setInvalid();

	// inits the value with the current http-request
	public void init(Request req, boolean firstrun, Validator validator);

	public ValidationResult getValidationResult();

	public void setValidationResult(ValidationResult validationResult);

	public String getInputTag();

	public String getInputTag(Map<String, String> attributes, MessageSource messageSource, boolean html5Validation);
	
	@Deprecated
	public String getInputTag(Map<String, String> attributes);

	public boolean isRequired();

// Path: src/main/java/de/jformchecker/criteria/ValidationResult.java
// public class ValidationResult {
// 
// 	boolean isValid = false;
// 	
// 	// caching:
// 	private static ValidationResult okResult =  new ValidationResult(true, "", null, null);
// 
// 	public boolean isValid() {
// 		return isValid;
// 	}
// 
// 	public String getMessage() {
// 		return message;
// 	}
// 
// 	public Object[] getErrorVals() {
// 		return errorVals;
// 	}
// 
// 	String message;
// 	String translatedMessage;
// 	Object[] errorVals;
// 
// 	public ValidationResult(boolean isValid, String message, Object[] errorVals, String translatedMessage) {
// 		this.isValid = isValid;
// 		this.message = message;
// 		this.errorVals = errorVals;
// 		this.translatedMessage = translatedMessage;
// 	}
// 
// 	// factory methods
// 	public static ValidationResult of_(boolean isValid, String message, Object... errorVals) {
// 		return new ValidationResult(isValid, message, errorVals, null);
// 	}
// 
// 	public static ValidationResult fail(String message, Object... errorVals) {
// 		return new ValidationResult(false, message, errorVals, null);
// 	}
// 
// 	public static ValidationResult failWithTranslated(String message, Object... errorVals) {
// 		return new ValidationResult(false, null, errorVals, message);
// 	}
// 
// 	public static ValidationResult failWithTranslated(String message) {
// 		return new ValidationResult(false, null, new Object[0], message);
// 	}
// 	
// 	public static ValidationResult ok() {
// 		// RFE: Could return always the same object! will reduce memory
// 		// footprint!
// 		return okResult;
// 	}
// 
// 	public String getTranslatedMessage() {
// 		return translatedMessage;
// 	}
// 
// }
// 
// Path: src/main/java/de/jformchecker/message/MessageSource.java
// @FunctionalInterface
// public interface MessageSource {
// 
// 	public String getMessage(String key);
// 
// 	public default String getSafeMessage(String key) {
// 		try {
// 			String msg = this.getMessage(key);
// 			return msg;
// 		} catch (Exception e) {
// 			return "??" + key + "??";
// 		}
// 	}
// 
// 	
// 	public default String getMessage(ValidationResult vr) {
// 		// give translated messages higher prio than message-keys
// 		if (vr.getTranslatedMessage() != null) {
// 			return vr.getTranslatedMessage();
// 		} else 
// 		if (vr.getMessage() != null) {
// 			return(String.format(this.getSafeMessage(
// 					vr.getMessage()
// 					), vr.getErrorVals()));
// 			
// 		} else {
// 			throw new IllegalArgumentException("ValidationResult has neither message-key nor translated text");
// 		}
// 	}
// 
// }
// 
// Path: src/main/java/de/jformchecker/request/Request.java
// @FunctionalInterface
// public interface Request {
// 	public String getParameter(String name);
// }
// 
// Path: src/main/java/de/jformchecker/validator/Validator.java
// public interface Validator {
// 
// 	ValidationResult validate(FormCheckerElement elem);
// 
// }


// Path: src/main/java/de/jformchecker/FormCheckerElement.java
import java.util.List;
import java.util.Map;
import de.jformchecker.criteria.ValidationResult;
import de.jformchecker.message.MessageSource;
import de.jformchecker.request.Request;
import de.jformchecker.validator.Validator;

package de.jformchecker;



/**
 * Interface for Input-Elements handled by formchecker
 * 
 * @author jochen
 *
 */
public interface FormCheckerElement {

	// RFE: check, if some methods can be protected

	// get internal name of this input-element
	public String getName();
	
	// set internal name
	public void setName(String name);


	// get the value that the user entered
	public String getValue();

	// get the value that the user entered, but html-encoded
	@Deprecated
	public String getValueHtmlEncoded();

	public void setValue(String value);

	public String getPreSetValue();

	// set an initial value to the element, before the user edited it.
	public <T extends FormCheckerElement> T setPreSetValue(String value);

	public <T extends FormCheckerElement> T setTabIndex(int tabIndex);

	public int getTabIndex();

	public int getLastTabIndex();

	// set the test in the label (builder pattern)
	
	public <T extends FormCheckerElement> T setDescription(String desc);

	// as "setDescription" but does not return anything (no builder pattern)
	public void changeDescription(String desc);

	public String getDescription();

	// returns true if element is valid
	public boolean isValid();

	public void setInvalid();

	// inits the value with the current http-request
	public void init(Request req, boolean firstrun, Validator validator);

	public ValidationResult getValidationResult();

	public void setValidationResult(ValidationResult validationResult);

	public String getInputTag();

	public String getInputTag(Map<String, String> attributes, MessageSource messageSource, boolean html5Validation);
	
	@Deprecated
	public String getInputTag(Map<String, String> attributes);

	public boolean isRequired();

	public <T extends FormCheckerElement> T setRequired();