提交 532dd160 编写于 作者: K kohsuke

enabled XStream annotation support

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@35709 71c3de6d-444a-0410-be80-ed276b4c234a
上级 5f81f94f
...@@ -451,7 +451,7 @@ THE SOFTWARE. ...@@ -451,7 +451,7 @@ THE SOFTWARE.
<dependency> <dependency>
<groupId>org.jvnet.hudson</groupId> <groupId>org.jvnet.hudson</groupId>
<artifactId>xstream</artifactId> <artifactId>xstream</artifactId>
<version>1.3.1-hudson-7</version> <version>1.3.1-hudson-8</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jfree</groupId> <groupId>jfree</groupId>
......
...@@ -25,6 +25,7 @@ package hudson.util; ...@@ -25,6 +25,7 @@ package hudson.util;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.mapper.AnnotationMapper;
import com.thoughtworks.xstream.mapper.Mapper; import com.thoughtworks.xstream.mapper.Mapper;
import com.thoughtworks.xstream.mapper.MapperWrapper; import com.thoughtworks.xstream.mapper.MapperWrapper;
import com.thoughtworks.xstream.converters.Converter; import com.thoughtworks.xstream.converters.Converter;
...@@ -109,7 +110,7 @@ public class XStream2 extends XStream { ...@@ -109,7 +110,7 @@ public class XStream2 extends XStream {
@Override @Override
protected MapperWrapper wrapMapper(MapperWrapper next) { protected MapperWrapper wrapMapper(MapperWrapper next) {
return new CompatibilityMapper(new MapperWrapper(next) { Mapper m = new CompatibilityMapper(new MapperWrapper(next) {
@Override @Override
public String serializedClass(Class type) { public String serializedClass(Class type) {
if (ImmutableMap.class.isAssignableFrom(type)) if (ImmutableMap.class.isAssignableFrom(type))
...@@ -118,6 +119,9 @@ public class XStream2 extends XStream { ...@@ -118,6 +119,9 @@ public class XStream2 extends XStream {
return super.serializedClass(type); return super.serializedClass(type);
} }
}); });
AnnotationMapper a = new AnnotationMapper(m, getConverterRegistry(), getClassLoader(), getReflectionProvider(), getJvm());
a.autodetectAnnotations(true);
return a;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册