File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\core\src\main\java\hudson\util\xstream\MapperDelegate.java.html

1 /*
2 * Copyright (C) 2005, 2006 Joe Walnes.
3 * Copyright (C) 2006, 2007, 2008 XStream Committers.
4 * All rights reserved.
5 *
6 * The software in this package is published under the terms of the BSD
7 * style license a copy of which has been included with this distribution in
8 * the LICENSE.txt file.
9 *
10 * Created on 22. January 2005 by Joe Walnes
11 */
12 package hudson.util.xstream;
13
14 import com.thoughtworks.xstream.XStream;
15 import com.thoughtworks.xstream.converters.Converter;
16 import com.thoughtworks.xstream.converters.SingleValueConverter;
17 import com.thoughtworks.xstream.mapper.Mapper;
18 import com.thoughtworks.xstream.mapper.MapperWrapper;
19
20 /**
21 * Works like {@link MapperWrapper} except it lets the subtype
22 * change the delegation target.
23 *
24 * <p>
25 * Since {@link XStream} caches the result of mapper pipeline,
26 * the kind of mutation and when you can do it is limited.
27 *
28 * @author Kohsuke Kawaguchi
29 */
30 public class MapperDelegate extends MapperWrapper {
31 protected Mapper delegate;
32
33 public MapperDelegate(Mapper delegate) {
34 super(null);
35 this.delegate = delegate;
36 }
37
38 public String serializedClass(Class type) {
39 return delegate.serializedClass(type);
40 }
41
42 public Class realClass(String elementName) {
43 return delegate.realClass(elementName);
44 }
45
46 public String serializedMember(Class type, String memberName) {
47 return delegate.serializedMember(type, memberName);
48 }
49
50 public String realMember(Class type, String serialized) {
51 return delegate.realMember(type, serialized);
52 }
53
54 public boolean isImmutableValueType(Class type) {
55 return delegate.isImmutableValueType(type);
56 }
57
58 public Class defaultImplementationOf(Class type) {
59 return delegate.defaultImplementationOf(type);
60 }
61
62 /**
63 * @deprecated since 1.2, use aliasForAttribute instead.
64 */
65 public String attributeForClassDefiningField() {
66 return delegate.attributeForClassDefiningField();
67 }
68
69 /**
70 * @deprecated since 1.2, use aliasForAttribute instead.
71 */
72 public String attributeForImplementationClass() {
73 return delegate.attributeForImplementationClass();
74 }
75
76 /**
77 * @deprecated since 1.2, use aliasForAttribute instead.
78 */
79 public String attributeForReadResolveField() {
80 return delegate.attributeForReadResolveField();
81 }
82
83 /**
84 * @deprecated since 1.2, use aliasForAttribute instead.
85 */
86 public String attributeForEnumType() {
87 return delegate.attributeForEnumType();
88 }
89
90 public String aliasForAttribute(String attribute) {
91 return delegate.aliasForAttribute(attribute);
92 }
93
94 public String attributeForAlias(String alias) {
95 return delegate.attributeForAlias(alias);
96 }
97
98 public String aliasForSystemAttribute(String attribute) {
99 return delegate.aliasForSystemAttribute(attribute);
100 }
101
102 public String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName) {
103 return delegate.getFieldNameForItemTypeAndName(definedIn, itemType, itemFieldName);
104 }
105
106 public Class getItemTypeForItemFieldName(Class definedIn, String itemFieldName) {
107 return delegate.getItemTypeForItemFieldName(definedIn, itemFieldName);
108 }
109
110 public ImplicitCollectionMapping getImplicitCollectionDefForFieldName(Class itemType, String fieldName) {
111 return delegate.getImplicitCollectionDefForFieldName(itemType, fieldName);
112 }
113
114 public boolean shouldSerializeMember(Class definedIn, String fieldName) {
115 return delegate.shouldSerializeMember(definedIn, fieldName);
116 }
117
118 /**
119 * @deprecated since 1.3, use {@link #getConverterFromItemType(String, Class, Class)}
120 */
121 public SingleValueConverter getConverterFromItemType(String fieldName, Class type) {
122 return delegate.getConverterFromItemType(fieldName, type);
123 }
124
125 /**
126 * @deprecated since 1.3, use {@link #getConverterFromItemType(String, Class, Class)}
127 */
128 public SingleValueConverter getConverterFromItemType(Class type) {
129 return delegate.getConverterFromItemType(type);
130 }
131
132 /**
133 * @deprecated since 1.3, use {@link #getConverterFromAttribute(Class, String, Class)}
134 */
135 public SingleValueConverter getConverterFromAttribute(String name) {
136 return delegate.getConverterFromAttribute(name);
137 }
138
139 public Converter getLocalConverter(Class definedIn, String fieldName) {
140 return delegate.getLocalConverter(definedIn, fieldName);
141 }
142
143 public Mapper lookupMapperOfType(Class type) {
144 return type.isAssignableFrom(getClass()) ? this : delegate.lookupMapperOfType(type);
145 }
146
147 public SingleValueConverter getConverterFromItemType(String fieldName, Class type, Class definedIn) {
148 return delegate.getConverterFromItemType(fieldName, type, definedIn);
149 }
150
151 /**
152 * @deprecated since 1.3, use combination of {@link #serializedMember(Class, String)} and {@link #getConverterFromItemType(String, Class, Class)}
153 */
154 public String aliasForAttribute(Class definedIn, String fieldName) {
155 return delegate.aliasForAttribute(definedIn, fieldName);
156 }
157
158 /**
159 * @deprecated since 1.3, use combination of {@link #realMember(Class, String)} and {@link #getConverterFromItemType(String, Class, Class)}
160 */
161 public String attributeForAlias(Class definedIn, String alias) {
162 return delegate.attributeForAlias(definedIn, alias);
163 }
164
165 /**
166 * @deprecated since 1.3.1, use {@link #getConverterFromAttribute(Class, String, Class)}
167 */
168 public SingleValueConverter getConverterFromAttribute(Class type, String attribute) {
169 return delegate.getConverterFromAttribute(type, attribute);
170 }
171
172 public SingleValueConverter getConverterFromAttribute(Class definedIn, String attribute, Class type) {
173 return delegate.getConverterFromAttribute(definedIn, attribute, type);
174 }
175 }
176