001: /*
002: * Copyright (C) 2005, 2006 Joe Walnes.
003: * Copyright (C) 2006, 2007, 2008 XStream Committers.
004: * All rights reserved.
005: *
006: * The software in this package is published under the terms of the BSD
007: * style license a copy of which has been included with this distribution in
008: * the LICENSE.txt file.
009: *
010: * Created on 22. January 2005 by Joe Walnes
011: */
012: package com.thoughtworks.xstream.mapper;
013:
014: import com.thoughtworks.xstream.alias.ClassMapper;
015: import com.thoughtworks.xstream.converters.Converter;
016: import com.thoughtworks.xstream.converters.SingleValueConverter;
017:
018: public abstract class MapperWrapper implements Mapper {
019:
020: private final Mapper wrapped;
021:
022: public MapperWrapper(Mapper wrapped) {
023: this .wrapped = wrapped;
024: }
025:
026: /**
027: * @deprecated As of 1.2, use {@link #MapperWrapper(Mapper)}
028: */
029: public MapperWrapper(ClassMapper wrapped) {
030: this ((Mapper) wrapped);
031: }
032:
033: public String serializedClass(Class type) {
034: return wrapped.serializedClass(type);
035: }
036:
037: public Class realClass(String elementName) {
038: return wrapped.realClass(elementName);
039: }
040:
041: public String serializedMember(Class type, String memberName) {
042: return wrapped.serializedMember(type, memberName);
043: }
044:
045: public String realMember(Class type, String serialized) {
046: return wrapped.realMember(type, serialized);
047: }
048:
049: public boolean isImmutableValueType(Class type) {
050: return wrapped.isImmutableValueType(type);
051: }
052:
053: public Class defaultImplementationOf(Class type) {
054: return wrapped.defaultImplementationOf(type);
055: }
056:
057: /**
058: * @deprecated since 1.2, use aliasForAttribute instead.
059: */
060: public String attributeForClassDefiningField() {
061: return wrapped.attributeForClassDefiningField();
062: }
063:
064: /**
065: * @deprecated since 1.2, use aliasForAttribute instead.
066: */
067: public String attributeForImplementationClass() {
068: return wrapped.attributeForImplementationClass();
069: }
070:
071: /**
072: * @deprecated since 1.2, use aliasForAttribute instead.
073: */
074: public String attributeForReadResolveField() {
075: return wrapped.attributeForReadResolveField();
076: }
077:
078: /**
079: * @deprecated since 1.2, use aliasForAttribute instead.
080: */
081: public String attributeForEnumType() {
082: return wrapped.attributeForEnumType();
083: }
084:
085: public String aliasForAttribute(String attribute) {
086: return wrapped.aliasForAttribute(attribute);
087: }
088:
089: public String attributeForAlias(String alias) {
090: return wrapped.attributeForAlias(alias);
091: }
092:
093: public String getFieldNameForItemTypeAndName(Class definedIn,
094: Class itemType, String itemFieldName) {
095: return wrapped.getFieldNameForItemTypeAndName(definedIn,
096: itemType, itemFieldName);
097: }
098:
099: public Class getItemTypeForItemFieldName(Class definedIn,
100: String itemFieldName) {
101: return wrapped.getItemTypeForItemFieldName(definedIn,
102: itemFieldName);
103: }
104:
105: public ImplicitCollectionMapping getImplicitCollectionDefForFieldName(
106: Class itemType, String fieldName) {
107: return wrapped.getImplicitCollectionDefForFieldName(itemType,
108: fieldName);
109: }
110:
111: public boolean shouldSerializeMember(Class definedIn,
112: String fieldName) {
113: return wrapped.shouldSerializeMember(definedIn, fieldName);
114: }
115:
116: /**
117: * @deprecated since 1.3, use {@link #getConverterFromItemType(String, Class, Class)}
118: */
119: public SingleValueConverter getConverterFromItemType(
120: String fieldName, Class type) {
121: return wrapped.getConverterFromItemType(fieldName, type);
122: }
123:
124: /**
125: * @deprecated since 1.3, use {@link #getConverterFromItemType(String, Class, Class)}
126: */
127: public SingleValueConverter getConverterFromItemType(Class type) {
128: return wrapped.getConverterFromItemType(type);
129: }
130:
131: /**
132: * @deprecated since 1.3, use {@link #getConverterFromAttribute(Class, String)}
133: */
134: public SingleValueConverter getConverterFromAttribute(String name) {
135: return wrapped.getConverterFromAttribute(name);
136: }
137:
138: public Converter getLocalConverter(Class definedIn, String fieldName) {
139: return wrapped.getLocalConverter(definedIn, fieldName);
140: }
141:
142: public Mapper lookupMapperOfType(Class type) {
143: return type.isAssignableFrom(getClass()) ? this : wrapped
144: .lookupMapperOfType(type);
145: }
146:
147: public SingleValueConverter getConverterFromItemType(
148: String fieldName, Class type, Class definedIn) {
149: return wrapped.getConverterFromItemType(fieldName, type,
150: definedIn);
151: }
152:
153: /**
154: * @deprecated since 1.3, use combination of {@link #serializedMember(Class, String)} and {@link #getConverterFromItemType(String, Class, Class)}
155: */
156: public String aliasForAttribute(Class definedIn, String fieldName) {
157: return wrapped.aliasForAttribute(definedIn, fieldName);
158: }
159:
160: /**
161: * @deprecated since 1.3, use combination of {@link #realMember(Class, String)} and {@link #getConverterFromItemType(String, Class, Class)}
162: */
163: public String attributeForAlias(Class definedIn, String alias) {
164: return wrapped.attributeForAlias(definedIn, alias);
165: }
166:
167: public SingleValueConverter getConverterFromAttribute(Class type,
168: String attribute) {
169: return wrapped.getConverterFromAttribute(type, attribute);
170: }
171:
172: }
|