diff --git a/core/src/main/java/com/opensymphony/xwork2/conversion/metadata/ConversionDescription.java b/core/src/main/java/com/opensymphony/xwork2/conversion/metadata/ConversionDescription.java deleted file mode 100644 index 74c6d6e6d..000000000 --- a/core/src/main/java/com/opensymphony/xwork2/conversion/metadata/ConversionDescription.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.conversion.metadata; - -import com.opensymphony.xwork2.conversion.annotations.ConversionRule; -import com.opensymphony.xwork2.conversion.impl.DefaultObjectTypeDeterminer; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.LogManager; - -import java.io.PrintWriter; -import java.io.StringWriter; - -/** - * ConversionDescription - * - * @author Rainer Hermanns - * @version $Id$ - * - * @deprecated class will be removed - */ -@Deprecated -public class ConversionDescription { - - /** - * Jakarta commons-logging reference. - */ - protected static Logger log = null; - - - public static final String KEY_PREFIX = "Key_"; - public static final String ELEMENT_PREFIX = "Element_"; - public static final String KEY_PROPERTY_PREFIX = "KeyProperty_"; - public static final String DEPRECATED_ELEMENT_PREFIX = "Collection_"; - - /** - * Key used for type conversion of maps. - */ - String MAP_PREFIX = "Map_"; - - public String property; - public String typeConverter = ""; - public String rule = ""; - public String value = ""; - public String fullQualifiedClassName; - public String type = null; - - public ConversionDescription() { - log = LogManager.getLogger(this.getClass()); - } - - /** - * Creates an ConversionDescription with the specified property name. - * - * @param property property - */ - public ConversionDescription(String property) { - this.property = property; - log = LogManager.getLogger(this.getClass()); - } - - /** - *

- * Sets the property name to be inserted into the related conversion.properties file.
- * Note: Do not add COLLECTION_PREFIX or MAP_PREFIX keys to property names. - *

- * - * @param property The property to be converted. - */ - public void setProperty(String property) { - this.property = property; - } - - /** - * Sets the class name of the type converter to be used. - * - * @param typeConverter The class name of the type converter. - */ - public void setTypeConverter(String typeConverter) { - this.typeConverter = typeConverter; - } - - /** - * @param rule the rule prefix for COLLECTION_PREFIX or MAP_PREFIX key. Defaults to en empty String. - */ - public void setRule(String rule) { - if (rule != null && rule.length() > 0) { - if (rule.equals(ConversionRule.COLLECTION.toString())) { - this.rule = DefaultObjectTypeDeterminer.DEPRECATED_ELEMENT_PREFIX; - } else if (rule.equals(ConversionRule.ELEMENT.toString())) { - this.rule = DefaultObjectTypeDeterminer.ELEMENT_PREFIX; - } else if (rule.equals(ConversionRule.KEY.toString())) { - this.rule = DefaultObjectTypeDeterminer.KEY_PREFIX; - } else if (rule.equals(ConversionRule.KEY_PROPERTY.toString())) { - this.rule = DefaultObjectTypeDeterminer.KEY_PROPERTY_PREFIX; - } else if (rule.equals(ConversionRule.MAP.toString())) { - this.rule = MAP_PREFIX; - } - } - } - - - public void setType(String type) { - this.type = type; - } - - public String getType() { - return type; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - /** - * Returns the conversion description as property entry. - *

- * Example:
- * property.name = converter.className
- * Collection_property.name = converter.className
- * Map_property.name = converter.className - * KeyProperty_name = id - *

- * - * @return the conversion description as property entry. - */ - public String asProperty() { - StringWriter sw = new StringWriter(); - PrintWriter writer = null; - try { - writer = new PrintWriter(sw); - writer.print(rule); - writer.print(property); - writer.print("="); - if ( rule.startsWith(DefaultObjectTypeDeterminer.KEY_PROPERTY_PREFIX) && value != null && value.length() > 0 ) { - writer.print(value); - } else { - writer.print(typeConverter); - } - } finally { - if (writer != null) { - writer.flush(); - writer.close(); - } - } - - return sw.toString(); - - } - - /** - * Returns the fullQualifiedClassName attribute is used to create the special conversion.properties file name. - * - * @return full qualified class name - */ - public String getFullQualifiedClassName() { - return fullQualifiedClassName; - } - - /** - * The fullQualifiedClassName attribute is used to create the special conversion.properties file name. - * - * @param fullQualifiedClassName a full qualified class name - */ - public void setFullQualifiedClassName(String fullQualifiedClassName) { - this.fullQualifiedClassName = fullQualifiedClassName; - } -} diff --git a/core/src/main/java/com/opensymphony/xwork2/conversion/metadata/package.html b/core/src/main/java/com/opensymphony/xwork2/conversion/metadata/package.html deleted file mode 100644 index e48517d45..000000000 --- a/core/src/main/java/com/opensymphony/xwork2/conversion/metadata/package.html +++ /dev/null @@ -1,21 +0,0 @@ - -Type conversion meta data classes.