com.thoughtworks.xstream.XStream.getReflectionProvider()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中com.thoughtworks.xstream.XStream.getReflectionProvider()方法的一些代码示例,展示了XStream.getReflectionProvider()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XStream.getReflectionProvider()方法的具体详情如下:
包路径:com.thoughtworks.xstream.XStream
类名称:XStream
方法名:getReflectionProvider

XStream.getReflectionProvider介绍

[英]Retrieve the ReflectionProvider in use.
[中]检索正在使用的ReflectionProvider。

代码示例

代码示例来源:origin: jenkinsci/jenkins

public RobustCollectionConverter(XStream xs) {
  this(xs.getMapper(),xs.getReflectionProvider());
}

代码示例来源:origin: jenkinsci/jenkins

public ImmutableSetConverter(XStream xs) {
  this(xs.getMapper(),xs.getReflectionProvider());
}

代码示例来源:origin: jenkinsci/jenkins

public ImmutableMapConverter(XStream xs) {
  this(xs.getMapper(),xs.getReflectionProvider());
}

代码示例来源:origin: jenkinsci/jenkins

public ImmutableSortedSetConverter(XStream xs) {
  this(xs.getMapper(),xs.getReflectionProvider());
}

代码示例来源:origin: jenkinsci/jenkins

public ImmutableListConverter(XStream xs) {
  this(xs.getMapper(),xs.getReflectionProvider());
}

代码示例来源:origin: geoserver/geoserver

public AbstractReflectionConverter(Class clazz) {
  super(getXStream().getMapper(), getXStream().getReflectionProvider());
  this.clazz = clazz;
}

代码示例来源:origin: stackoverflow.com

XStream xs = new XStream(new DomDriver());
 Mapper mapper = xs.getMapper();
 ReflectionProvider reflectionProvider = xs.getReflectionProvider();
 xs.alias("youralias", YourRoot.class);
 xs.registerConverter(new MyConverter(mapper, reflectionProvider,
     YourRoot.class, map));
 System.out.println(xs.toXML(yourRoot));

代码示例来源:origin: org.hudsonci.plugins/git

/**
 * Registering legacy converters and aliases for backward compatibility with org.spearce.jgit library
 */
private void beforeLoad() {
  Items.XSTREAM.alias("ObjectId", ObjectId.class);
  Items.XSTREAM.alias("RemoteConfig", RemoteConfig.class);
  Items.XSTREAM.alias("RemoteConfig", org.spearce.jgit.transport.RemoteConfig.class);
  Items.XSTREAM.alias("RemoteConfig", GitRepository.class);
  Items.XSTREAM.registerConverter(
    new RemoteConfigConverter(Items.XSTREAM.getMapper(), Items.XSTREAM.getReflectionProvider()));
  Run.XSTREAM.registerConverter(new ObjectIdConverter());
}

代码示例来源:origin: org.jenkins-ci.plugins/git

/**
 * Create remote config converter.
 * 
 * @param xStream XStream used for remote configuration conversion
 */
public RemoteConfigConverter(XStream xStream) {
  mapper = xStream.getMapper();
  converter = new SerializableConverter(mapper,
      xStream.getReflectionProvider());
}

代码示例来源:origin: sakaiproject/sakai

protected static XStream getXStream() {
  final XStream xstream = new XStream(new DomDriver());	// does not require XPP3 library
  xstream.registerConverter(new Converter(xstream.getMapper(), xstream.getReflectionProvider()));
  return xstream;
}

代码示例来源:origin: org.sakaiproject.edu-services.gradebook/gradebook-service-impl

protected static XStream getXStream() {
  XStream xstream = new XStream(new DomDriver());	// does not require XPP3 library
  xstream.registerConverter(new Converter(xstream.getMapper(), xstream.getReflectionProvider()));
  return xstream;
}

代码示例来源:origin: org.geoserver/xslt

@Override
protected void configureXStream(XStream xs) {
  super.configureXStream(xs);
  xs.alias("transform", TransformInfo.class);
  xs.registerConverter(new TransformConverter(xs.getMapper(), xs.getReflectionProvider()));
  xs.registerLocalConverter(TransformInfo.class, "featureType",
      new FeatureTypeLinkConverter());
  xs.addDefaultImplementation(FeatureTypeInfoImpl.class, FeatureTypeInfo.class);
}

代码示例来源:origin: caelum/vraptor

/**
   * You can override this method for configuring XStream before serialization.
   * It configures the xstream instance with a link converter for all StateResource implementations.
   */
  @Override
  protected XStream getXStream() {
    XStream xStream = super.getXStream();
    MethodValueSupportConverter converter = new MethodValueSupportConverter(new ReflectionConverter(xStream.getMapper(), xStream.getReflectionProvider()));
    xStream.registerConverter(new LinkConverterJSON(converter, restfulie, config));
    return xStream;
  }
}

代码示例来源:origin: org.geoserver.community/gs-notification-common

@Override
public void init(XStream xs) {
  xs.aliasAttribute(DefaultNotificationProcessor.class, "sender", name);
  xs.registerLocalConverter(
      DefaultNotificationProcessor.class,
      "sender",
      new SenderConverter(xs.getMapper(), xs.getReflectionProvider(), this));
}

代码示例来源:origin: org.geoserver.community/gs-notification-common

@Override
public void init(XStream xs) {
  xs.aliasAttribute(DefaultNotificationProcessor.class, "encoder", name);
  xs.registerLocalConverter(
      DefaultNotificationProcessor.class,
      "encoder",
      new EncoderConverter(xs.getMapper(), xs.getReflectionProvider(), this));
}

代码示例来源:origin: caelum/vraptor

/**
 * You can override this method for configuring XStream before serialization.
 * It configures the xstream instance with a link converter for all StateResource implementations.
 */
@Override
protected XStream getXStream() {
  XStream xStream = super.getXStream();
  MethodValueSupportConverter converter = new MethodValueSupportConverter(new ReflectionConverter(xStream.getMapper(), xStream.getReflectionProvider()));
  xStream.registerConverter(new LinkConverter(converter, restfulie, config));
  return xStream;
}

代码示例来源:origin: caelum/vraptor

@Before
public void setup() {
  MockitoAnnotations.initMocks(this);
  this.restfulie = mock(Restfulie.class);
  when(restfulie.newRelationBuilder()).thenReturn(builder);
  Configuration config = mock(Configuration.class);
  when(config.getApplicationPath()).thenReturn("http://www.caelum.com.br");
  xstream = new XStream();
  ReflectionConverter base = new ReflectionConverter(xstream.getMapper(), xstream.getReflectionProvider());
  xstream.registerConverter(new LinkConverter(base, restfulie, config));
}

代码示例来源:origin: caelum/vraptor

@Before
public void setup() {
  MockitoAnnotations.initMocks(this);
  this.restfulie = mock(Restfulie.class);
  when(restfulie.newRelationBuilder()).thenReturn(builder);
  Configuration config = mock(Configuration.class);
  when(config.getApplicationPath()).thenReturn("http://www.caelum.com.br");
  xstream = new XStream(new JsonHierarchicalStreamDriver());
  ReflectionConverter base = new ReflectionConverter(xstream.getMapper(), xstream.getReflectionProvider());
  xstream.registerConverter(new LinkConverterJSON(base, restfulie, config));
}

代码示例来源:origin: caelum/vraptor

@Test
public void whenMethodReturnsAComplexTypeSerializesIt() {
  XStream x = new XStream();
  x.alias("friend", Friend.class);
  x.alias("player", Player.class);
  x.registerConverter(new MethodValueSupportConverter(new ReflectionConverter(x.getMapper(), x.getReflectionProvider())), XStream.PRIORITY_LOW);
  String content = x.toXML(new Friend());
  assertThat(content, is(equalTo("<friend>\n  <player>\n    <name>custom_name</name>\n  </player>\n</friend>")));
}

代码示例来源:origin: caelum/vraptor

@Test
public void whenMethodIsAnnotatedAddsItsContent() {
  XStream x = new XStream();
  x.alias("player", Player.class);
  x.registerConverter(new MethodValueSupportConverter(new ReflectionConverter(x.getMapper(), x.getReflectionProvider())), XStream.PRIORITY_LOW);
  String content = x.toXML(new Player());
  assertThat(content, is(equalTo("<player>\n  <name>custom_name</name>\n</player>")));
}

相关文章