From cbe1d02cc59eb418030f6a6fcdf57ecf244badc8 Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Wed, 28 Nov 2012 20:12:49 +0000 Subject: [PATCH] Removes metadata as it's useless now git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1414891 13f79535-47bb-0310-9956-ffa450edef68 --- .../AbstractFieldValidatorDescription.java | 133 --------------- ...versionErrorFieldValidatorDescription.java | 118 -------------- .../DateRangeFieldValidatorDescription.java | 140 ---------------- .../DoubleRangeFieldValidatorDescription.java | 142 ---------------- .../metadata/EmailValidatorDescription.java | 119 -------------- .../ExpressionValidatorDescription.java | 94 ----------- .../FieldExpressionValidatorDescription.java | 114 ------------- .../IntRangeFieldValidatorDescription.java | 145 ----------------- .../RequiredFieldValidatorDescription.java | 116 ------------- .../RequiredStringValidatorDescription.java | 129 --------------- ...StringLengthFieldValidatorDescription.java | 153 ------------------ .../metadata/URLValidatorDescription.java | 117 -------------- .../metadata/ValidatorDescription.java | 62 ------- .../VisitorFieldValidatorDescription.java | 105 ------------ .../xwork2/validator/metadata/package.html | 1 - 15 files changed, 1688 deletions(-) delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/AbstractFieldValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/ConversionErrorFieldValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/DateRangeFieldValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/DoubleRangeFieldValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/EmailValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/ExpressionValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/FieldExpressionValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/IntRangeFieldValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/RequiredFieldValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/RequiredStringValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/StringLengthFieldValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/URLValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/ValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/VisitorFieldValidatorDescription.java delete mode 100644 xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/package.html diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/AbstractFieldValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/AbstractFieldValidatorDescription.java deleted file mode 100644 index 076e3b8aa..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/AbstractFieldValidatorDescription.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -import com.opensymphony.xwork2.util.logging.Logger; -import com.opensymphony.xwork2.util.logging.LoggerFactory; - -/** - * AbstractFieldValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public abstract class AbstractFieldValidatorDescription implements ValidatorDescription { - - /** - * Jakarta commons-logging reference. - */ - protected static Logger log = null; - - public String fieldName; - public String key; - public String message; - public boolean shortCircuit; - public boolean simpleValidator; - - - public AbstractFieldValidatorDescription() { - log = LoggerFactory.getLogger(this.getClass()); - } - - /** - * Creates an AbstractFieldValidatorDescription with the specified field name. - * - * @param fieldName - */ - public AbstractFieldValidatorDescription(String fieldName) { - this.fieldName = fieldName; - log = LoggerFactory.getLogger(this.getClass()); - } - - /** - * Sets the field name for this validator rule. - * - * @return fieldName the field name for this validator rule - */ - public String getFieldName() { - return fieldName; - } - - /** - * Sets the field name for this validator rule. - * - * @param fieldName the field name for this validator rule - */ - public void setFieldName(String fieldName) { - this.fieldName = fieldName; - } - - /** - * Sets the I18N message key. - * @param key the I18N message key - */ - public void setKey(String key) { - this.key = key; - } - - /** - * Sets the default validator failure message. - * - * @param message the default validator failure message - */ - public void setMessage(String message) { - this.message = message; - } - - /** - * Set the shortCircuit flag. - * - * @param shortCircuit the shortCircuit flag. - */ - public void setShortCircuit(boolean shortCircuit) { - this.shortCircuit = shortCircuit; - } - - public void setSimpleValidator(boolean simpleValidator) { - this.simpleValidator = simpleValidator; - } - - public boolean isSimpleValidator() { - return simpleValidator; - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - public String asXml() { - if ( simpleValidator) { - return asSimpleXml(); - } - return asFieldXml(); - } - - /** - * Returns the field validator XML definition. - * - * @return the field validator XML definition. - */ - public abstract String asFieldXml(); - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - public abstract String asSimpleXml(); - -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/ConversionErrorFieldValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/ConversionErrorFieldValidatorDescription.java deleted file mode 100644 index ce62cfc5c..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/ConversionErrorFieldValidatorDescription.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * ConversionErrorFieldValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public class ConversionErrorFieldValidatorDescription extends AbstractFieldValidatorDescription { - - public ConversionErrorFieldValidatorDescription() { - super(); - } - - /** - * Creates an AbstractFieldValidatorDescription with the specified field name. - * - * @param fieldName - */ - public ConversionErrorFieldValidatorDescription(String fieldName) { - super(fieldName); - } - - - /** - * Returns the field validator XML definition. - * - * @return the field validator XML definition. - */ - @Override - public String asFieldXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if (shortCircuit) { - writer.println("\t\t"); - } else { - writer.println("\t\t"); - } - - if (!"".equals(key)) { - writer.println("\t\t\t" + message + ""); - } else { - writer.println("\t\t\t" + message + ""); - } - - writer.println("\t\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asSimpleXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if (shortCircuit) { - writer.println("\t"); - } else { - writer.println("\t"); - } - - writer.println("\t\t" + fieldName + ""); - - if (!"".equals(key)) { - writer.println("\t\t" + message + ""); - } else { - writer.println("\t\t" + message + ""); - } - - writer.println("\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - } - -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/DateRangeFieldValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/DateRangeFieldValidatorDescription.java deleted file mode 100644 index 6d41713f0..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/DateRangeFieldValidatorDescription.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * DateRangeFieldValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public class DateRangeFieldValidatorDescription extends AbstractFieldValidatorDescription { - - public String min; - public String max; - - public DateRangeFieldValidatorDescription() { - } - - /** - * Creates an AbstractFieldValidatorDescription with the specified field name. - * - * @param fieldName - */ - public DateRangeFieldValidatorDescription(String fieldName) { - super(fieldName); - } - - public void setMin(String min) { - this.min = min; - } - - public void setMax(String max) { - this.max = max; - } - - /** - * Returns the field validator XML definition. - * - * @return the field validator XML definition. - */ - @Override - public String asFieldXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t\t"); - } else { - writer.println("\t\t"); - } - if ( min != null && min.length() > 0) { - writer.println("\t\t\t" + min + ""); - } - if ( max != null && max.length() > 0) { - writer.println("\t\t\t" + max + ""); - } - - if ( !"".equals(key)) { - writer.println("\t\t\t" + message + ""); - } else { - writer.println("\t\t\t" + message + ""); - } - - writer.println("\t\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asSimpleXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t"); - } else { - writer.println("\t"); - } - - writer.println("\t\t" + fieldName+ ""); - - - if ( min != null && min.length() > 0) { - writer.println("\t\t" + min + ""); - } - if ( max != null && max.length() > 0) { - writer.println("\t\t" + max + ""); - } - - if ( !"".equals(key)) { - writer.println("\t\t" + message + ""); - } else { - writer.println("\t\t" + message + ""); - } - - writer.println("\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - } -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/DoubleRangeFieldValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/DoubleRangeFieldValidatorDescription.java deleted file mode 100644 index 5b4515692..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/DoubleRangeFieldValidatorDescription.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.opensymphony.xwork2.validator.metadata; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * DoubleRangeFieldValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public class DoubleRangeFieldValidatorDescription extends AbstractFieldValidatorDescription { - - public String min; - public String max; - - public DoubleRangeFieldValidatorDescription() { - } - - /** - * Creates an DoubleRangeFieldValidatorDescription with the specified field name. - * - * @param fieldName - */ - public DoubleRangeFieldValidatorDescription(String fieldName) { - super(fieldName); - } - - public void setMin(String min) { - this.min = min; - } - - public void setMax(String max) { - this.max = max; - } - - /** - * Returns the field validator XML definition. - * - * @return the field validator XML definition. - */ - @Override - public String asFieldXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t\t"); - } else { - writer.println("\t\t"); - } - if ( min != null && min.length() > 0) { - writer.println("\t\t\t" + min + ""); - } - if ( max != null && max.length() > 0) { - writer.println("\t\t\t" + max + ""); - } - - if ( !"".equals(key)) { - writer.println("\t\t\t" + message + ""); - } else { - writer.println("\t\t\t" + message + ""); - } - - writer.println("\t\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asSimpleXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t"); - } else { - writer.println("\t"); - } - - writer.println("\t\t" + fieldName+ ""); - - - if ( min != null && min.length() > 0) { - writer.println("\t\t" + min + ""); - } - if ( max != null && max.length() > 0) { - writer.println("\t\t" + max + ""); - } - - if ( !"".equals(key)) { - writer.println("\t\t" + message + ""); - } else { - writer.println("\t\t" + message + ""); - } - - writer.println("\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - } - -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/EmailValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/EmailValidatorDescription.java deleted file mode 100644 index 134be4f98..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/EmailValidatorDescription.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * EmailValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public class EmailValidatorDescription extends AbstractFieldValidatorDescription { - - - public EmailValidatorDescription() { - } - - /** - * Creates an AbstractFieldValidatorDescription with the specified field name. - * - * @param fieldName - */ - public EmailValidatorDescription(String fieldName) { - super(fieldName); - } - - /** - * Returns the field validator XML definition. - * - * @return the field validator XML definition. - */ - @Override - public String asFieldXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t\t"); - } else { - writer.println("\t\t"); - } - - if ( !"".equals(key)) { - writer.println("\t\t\t" + message + ""); - } else { - writer.println("\t\t\t" + message + ""); - } - - writer.println("\t\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asSimpleXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t"); - } else { - writer.println("\t"); - } - - writer.println("\t\t" + fieldName+ ""); - - if ( !"".equals(key)) { - writer.println("\t\t" + message + ""); - } else { - writer.println("\t\t" + message + ""); - } - - writer.println("\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - } - - - -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/ExpressionValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/ExpressionValidatorDescription.java deleted file mode 100644 index 72e263afa..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/ExpressionValidatorDescription.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * ExpressionValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public class ExpressionValidatorDescription implements ValidatorDescription { - - public String expression; - public String key; - public String message; - public boolean shortCircuit; - - public void setExpression(String expression) { - this.expression = expression; - } - - public void setKey(String key) { - this.key = key; - } - - public void setMessage(String message) { - this.message = message; - } - - public void setShortCircuit(boolean shortCircuit) { - this.shortCircuit = shortCircuit; - } - - /** - * Returns the field name to create the validation rule for. - * - * @return The field name to create the validation rule for - */ - public String getFieldName() { - throw new UnsupportedOperationException("ExpressionValidator annotations cannot be applied to fields..."); - } - - public String asXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t"); - } else { - writer.println("\t"); - } - - writer.println("\t\t" + expression+ ""); - - if ( !"".equals(key)) { - writer.println("\t\t" + message + ""); - } else { - writer.println("\t\t" + message + ""); - } - - writer.println("\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - } - - public boolean isSimpleValidator() { - return false; - } -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/FieldExpressionValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/FieldExpressionValidatorDescription.java deleted file mode 100644 index 1e5e84e1b..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/FieldExpressionValidatorDescription.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * FieldExpressionValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public class FieldExpressionValidatorDescription extends AbstractFieldValidatorDescription { - - public String expression; - public String key; - public String message; - public boolean shortCircuit; - - public FieldExpressionValidatorDescription() { - } - - /** - * Creates an AbstractFieldValidatorDescription with the specified field name. - * - * @param fieldName - */ - public FieldExpressionValidatorDescription(String fieldName) { - super(fieldName); - } - - public void setExpression(String expression) { - this.expression = expression; - } - - @Override - public void setKey(String key) { - this.key = key; - } - - @Override - public void setMessage(String message) { - this.message = message; - } - - @Override - public void setShortCircuit(boolean shortCircuit) { - this.shortCircuit = shortCircuit; - } - - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asFieldXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t\t"); - } else { - writer.println("\t\t"); - } - - writer.println("\t\t\t" + expression+ ""); - - if ( !"".equals(key)) { - writer.println("\t\t\t" + message + ""); - } else { - writer.println("\t\t\t" + message + ""); - } - - writer.println("\t\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asSimpleXml() { - throw new UnsupportedOperationException(getClass().getName() + " cannot be used for simple validators..."); - } - -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/IntRangeFieldValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/IntRangeFieldValidatorDescription.java deleted file mode 100644 index 5cc403b3d..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/IntRangeFieldValidatorDescription.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * IntRangeFieldValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public class IntRangeFieldValidatorDescription extends AbstractFieldValidatorDescription { - - public String min; - public String max; - - public IntRangeFieldValidatorDescription() { - } - - /** - * Creates an AbstractFieldValidatorDescription with the specified field name. - * - * @param fieldName - */ - public IntRangeFieldValidatorDescription(String fieldName) { - super(fieldName); - } - - public void setMin(String min) { - this.min = min; - } - - public void setMax(String max) { - this.max = max; - } - - /** - * Returns the field validator XML definition. - * - * @return the field validator XML definition. - */ - @Override - public String asFieldXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t\t"); - } else { - writer.println("\t\t"); - } - if ( min != null && min.length() > 0) { - writer.println("\t\t\t" + min + ""); - } - if ( max != null && max.length() > 0) { - writer.println("\t\t\t" + max + ""); - } - - if ( !"".equals(key)) { - writer.println("\t\t\t" + message + ""); - } else { - writer.println("\t\t\t" + message + ""); - } - - writer.println("\t\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asSimpleXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t"); - } else { - writer.println("\t"); - } - - writer.println("\t\t" + fieldName+ ""); - - - if ( min != null && min.length() > 0) { - writer.println("\t\t" + min + ""); - } - if ( max != null && max.length() > 0) { - writer.println("\t\t" + max + ""); - } - - if ( !"".equals(key)) { - writer.println("\t\t" + message + ""); - } else { - writer.println("\t\t" + message + ""); - } - - writer.println("\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - } - - - - - -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/RequiredFieldValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/RequiredFieldValidatorDescription.java deleted file mode 100644 index 426cd6948..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/RequiredFieldValidatorDescription.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * RequiredFieldValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public class RequiredFieldValidatorDescription extends AbstractFieldValidatorDescription { - - public RequiredFieldValidatorDescription() { - } - - /** - * Creates an AbstractFieldValidatorDescription with the specified field name. - * - * @param fieldName - */ - public RequiredFieldValidatorDescription(String fieldName) { - super(fieldName); - } - - /** - * Returns the field validator XML definition. - * - * @return the field validator XML definition. - */ - @Override - public String asFieldXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t\t"); - } else { - writer.println("\t\t"); - } - - if ( !"".equals(key)) { - writer.println("\t\t\t" + message + ""); - } else { - writer.println("\t\t\t" + message + ""); - } - - writer.println("\t\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asSimpleXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t"); - } else { - writer.println("\t"); - } - - writer.println("\t\t" + fieldName+ ""); - - if ( !"".equals(key)) { - writer.println("\t\t" + message + ""); - } else { - writer.println("\t\t" + message + ""); - } - - writer.println("\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - } - -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/RequiredStringValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/RequiredStringValidatorDescription.java deleted file mode 100644 index 5868d87fa..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/RequiredStringValidatorDescription.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * RequiredStringValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public class RequiredStringValidatorDescription extends AbstractFieldValidatorDescription { - - public boolean trim = true; - - public RequiredStringValidatorDescription() { - } - - /** - * Creates an AbstractFieldValidatorDescription with the specified field name. - * - * @param fieldName - */ - public RequiredStringValidatorDescription(String fieldName) { - super(fieldName); - } - - public void setTrim(boolean trim) { - this.trim = trim; - } - - /** - * Returns the field validator XML definition. - * - * @return the field validator XML definition. - */ - @Override - public String asFieldXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t\t"); - } else { - writer.println("\t\t"); - } - if ( !trim) { - writer.println("\t\t\t" + trim + ""); - } - - if ( !"".equals(key)) { - writer.println("\t\t\t" + message + ""); - } else { - writer.println("\t\t\t" + message + ""); - } - - writer.println("\t\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asSimpleXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t"); - } else { - writer.println("\t"); - } - - writer.println("\t\t" + fieldName+ ""); - - if ( !trim) { - writer.println("\t\t" + trim + ""); - } - - if ( !"".equals(key)) { - writer.println("\t\t" + message + ""); - } else { - writer.println("\t\t" + message + ""); - } - - writer.println("\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - } - -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/StringLengthFieldValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/StringLengthFieldValidatorDescription.java deleted file mode 100644 index 878937e84..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/StringLengthFieldValidatorDescription.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * StringLengthFieldValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public class StringLengthFieldValidatorDescription extends AbstractFieldValidatorDescription { - - public boolean trim = true; - public String minLength; - public String maxLength; - - public StringLengthFieldValidatorDescription() { - } - - /** - * Creates an AbstractFieldValidatorDescription with the specified field name. - * - * @param fieldName - */ - public StringLengthFieldValidatorDescription(String fieldName) { - super(fieldName); - } - - public void setTrim(boolean trim) { - this.trim = trim; - } - - public void setMinLength(String minLength) { - this.minLength = minLength; - } - - public void setMaxLength(String maxLength) { - this.maxLength = maxLength; - } - - /** - * Returns the field validator XML definition. - * - * @return the field validator XML definition. - */ - @Override - public String asFieldXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t\t"); - } else { - writer.println("\t\t"); - } - if ( !trim) { - writer.println("\t\t\t" + trim + ""); - } - if ( minLength != null && minLength.length() > 0) { - writer.println("\t\t\t" + minLength + ""); - } - if ( maxLength != null && maxLength.length() > 0) { - writer.println("\t\t\t" + maxLength + ""); - } - - if ( !"".equals(key)) { - writer.println("\t\t\t" + message + ""); - } else { - writer.println("\t\t\t" + message + ""); - } - - writer.println("\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asSimpleXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t"); - } else { - writer.println("\t"); - } - - writer.println("\t\t" + fieldName+ ""); - - if ( !trim) { - writer.println("\t\t" + trim + ""); - } - - if ( minLength != null && minLength.length() > 0) { - writer.println("\t\t" + minLength + ""); - } - if ( maxLength != null && maxLength.length() > 0) { - writer.println("\t\t" + maxLength + ""); - } - - if ( !"".equals(key)) { - writer.println("\t\t" + message + ""); - } else { - writer.println("\t\t" + message + ""); - } - - writer.println("\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - } - - -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/URLValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/URLValidatorDescription.java deleted file mode 100644 index 6fe03e57a..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/URLValidatorDescription.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * URLValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public class URLValidatorDescription extends AbstractFieldValidatorDescription { - - - public URLValidatorDescription() { - } - - /** - * Creates an AbstractFieldValidatorDescription with the specified aliasNames. - * - * @param fieldName - */ - public URLValidatorDescription(String fieldName) { - super(fieldName); - } - - - /** - * Returns the field validator XML definition. - * - * @return the field validator XML definition. - */ - @Override - public String asFieldXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t\t"); - } else { - writer.println("\t\t"); - } - - if ( !"".equals(key)) { - writer.println("\t\t\t" + message + ""); - } else { - writer.println("\t\t\t" + message + ""); - } - - writer.println("\t\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asSimpleXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t"); - } else { - writer.println("\t"); - } - - writer.println("\t\t" + fieldName+ ""); - - if ( !"".equals(key)) { - writer.println("\t\t" + message + ""); - } else { - writer.println("\t\t" + message + ""); - } - - writer.println("\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - } -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/ValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/ValidatorDescription.java deleted file mode 100644 index cbf6f6224..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/ValidatorDescription.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -/** - * ValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public interface ValidatorDescription { - - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - String asXml(); - - /** - * Returns the field name to create the validation rule for. - * - * @return The field name to create the validation rule for - */ - String getFieldName(); - - /** - * Sets the I18N message key. - * @param key the I18N message key - */ - void setKey(String key); - - /** - * Sets the default validator failure message. - * - * @param message the default validator failure message - */ - void setMessage(String message); - - /** - * Set the shortCircuit flag. - * - * @param shortCircuit the shortCircuit flag. - */ - void setShortCircuit(boolean shortCircuit); - - boolean isSimpleValidator(); -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/VisitorFieldValidatorDescription.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/VisitorFieldValidatorDescription.java deleted file mode 100644 index eb618e93d..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/VisitorFieldValidatorDescription.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2.validator.metadata; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * VisitorFieldValidatorDescription - * - * @author Rainer Hermanns - * @version $Id$ - */ -public class VisitorFieldValidatorDescription extends AbstractFieldValidatorDescription { - - public String context; - public boolean appendPrefix = true; - - public VisitorFieldValidatorDescription() { - } - - /** - * Creates an AbstractFieldValidatorDescription with the specified field name. - * - * @param fieldName - */ - public VisitorFieldValidatorDescription(String fieldName) { - super(fieldName); - } - - public void setContext(String context) { - this.context = context; - } - - public void setAppendPrefix(boolean appendPrefix) { - this.appendPrefix = appendPrefix; - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asFieldXml() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - - try { - writer = new PrintWriter(sw); - - if ( shortCircuit) { - writer.println("\t\t"); - } else { - writer.println("\t\t"); - } - - if ( context != null && context.length() > 0) { - writer.println("\t\t\t" + context + ""); - } - - if ( !appendPrefix) { - writer.println("\t\t\t" + appendPrefix + ""); - } - - if ( !"".equals(key)) { - writer.println("\t\t\t" + message + ""); - } else { - writer.println("\t\t\t" + message + ""); - } - - writer.println("\t\t"); - - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - return sw.toString(); - } - - /** - * Returns the validator XML definition. - * - * @return the validator XML definition. - */ - @Override - public String asSimpleXml() { - throw new UnsupportedOperationException(getClass().getName() + " cannot be used for simple validators..."); - } -} diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/package.html b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/package.html deleted file mode 100644 index f0215156c..000000000 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/metadata/package.html +++ /dev/null @@ -1 +0,0 @@ -Validator meta data classes.