001: /*
002: * Copyright (c) 2002-2006 by OpenSymphony
003: * All rights reserved.
004: */
005: package com.opensymphony.xwork.validator;
006:
007: import java.util.Map;
008: import com.opensymphony.xwork.util.location.Located;
009:
010: /**
011: * Holds the necessary information for configuring an instance of a Validator.
012: *
013: *
014: * @author James House
015: * @author Rainer Hermanns
016: */
017: public class ValidatorConfig extends Located {
018:
019: private String type;
020: private Map params;
021: private String defaultMessage;
022: private String messageKey;
023: private boolean shortCircuit;
024:
025: public ValidatorConfig() {
026: }
027:
028: /**
029: * @param validatorType
030: * @param params
031: */
032: public ValidatorConfig(String validatorType, Map params) {
033: this .type = validatorType;
034: this .params = params;
035: }
036:
037: /**
038: * @return Returns the defaultMessage for the validator.
039: */
040: public String getDefaultMessage() {
041: return defaultMessage;
042: }
043:
044: /**
045: * @param defaultMessage The defaultMessage to set on the validator.
046: */
047: public void setDefaultMessage(String defaultMessage) {
048: this .defaultMessage = defaultMessage;
049: }
050:
051: /**
052: * @return Returns the messageKey for the validator.
053: */
054: public String getMessageKey() {
055: return messageKey;
056: }
057:
058: /**
059: * @param messageKey The messageKey to set on the validator.
060: */
061: public void setMessageKey(String messageKey) {
062: this .messageKey = messageKey;
063: }
064:
065: /**
066: * @return Returns wether the shortCircuit flag should be set on the
067: * validator.
068: */
069: public boolean isShortCircuit() {
070: return shortCircuit;
071: }
072:
073: /**
074: * @param shortCircuit Whether the validator's shortCircuit flag should
075: * be set.
076: */
077: public void setShortCircuit(boolean shortCircuit) {
078: this .shortCircuit = shortCircuit;
079: }
080:
081: /**
082: * @return Returns the configured params to set on the validator.
083: */
084: public Map getParams() {
085: return params;
086: }
087:
088: /**
089: * @param params The configured params to set on the validator.
090: */
091: public void setParams(Map params) {
092: this .params = params;
093: }
094:
095: /**
096: * @return Returns the type of validator to configure.
097: */
098: public String getType() {
099: return type;
100: }
101:
102: /**
103: * @param validatorType The type of validator to configure.
104: */
105: public void setType(String validatorType) {
106: this.type = validatorType;
107: }
108: }
|