com.thoughtworks.xstream.mapper.XmlFriendlyMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.apache.servicemix.bundles.xstream
Show all versions of org.apache.servicemix.bundles.xstream
This OSGi bundle wraps ${pkgArtifactId} ${pkgVersion} jar file.
/*
* Copyright (C) 2005, 2006 Joe Walnes.
* Copyright (C) 2006, 2007, 2008, 2009, 2011 XStream Committers.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
* style license a copy of which has been included with this distribution in
* the LICENSE.txt file.
*
* Created on 22. January 2005 by Joe Walnes
*/
package com.thoughtworks.xstream.mapper;
/**
* Mapper that ensures that all names in the serialization stream are XML friendly.
* The replacement chars and strings are:
*
* - $ (dollar) chars appearing in class names are replaced with _ (underscore) chars.
* - $ (dollar) chars appearing in field names are replaced with _DOLLAR_ string.
* - _ (underscore) chars appearing in field names are replaced with __ (double underscore) string.
* - default as the prefix for class names with no package.
*
*
* @author Joe Walnes
* @author Mauro Talevi
* @deprecated As of 1.3 use {@link com.thoughtworks.xstream.io.xml.XmlFriendlyReader}
*/
public class XmlFriendlyMapper extends AbstractXmlFriendlyMapper {
/**
* @deprecated As of 1.3 use {@link com.thoughtworks.xstream.io.xml.XmlFriendlyReader}
*/
public XmlFriendlyMapper(Mapper wrapped) {
super(wrapped);
}
public String serializedClass(Class type) {
return escapeClassName(super.serializedClass(type));
}
public Class realClass(String elementName) {
return super.realClass(unescapeClassName(elementName));
}
public String serializedMember(Class type, String memberName) {
return escapeFieldName(super.serializedMember(type, memberName));
}
public String realMember(Class type, String serialized) {
return unescapeFieldName(super.realMember(type, serialized));
}
public String mapNameToXML(String javaName) {
return escapeFieldName(javaName);
}
public String mapNameFromXML(String xmlName) {
return unescapeFieldName(xmlName);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy