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

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

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

XStream.getConverterLookup介绍

暂无

代码示例

代码示例来源:origin: com.thoughtworks.xstream/xstream

protected ConverterLookup getConverterLookup() {
  return xstream.getConverterLookup();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream-java8

protected ConverterLookup getConverterLookup() {
  return xstream.getConverterLookup();
}

代码示例来源:origin: x-stream/xstream

protected ConverterLookup getConverterLookup() {
  return xstream.getConverterLookup();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream

protected ConverterLookup getConverterLookup() {
  return xstream.getConverterLookup();
}

代码示例来源:origin: com.haulmont.thirdparty/xstream

protected ConverterLookup getConverterLookup() {
  return xstream.getConverterLookup();
}

代码示例来源:origin: org.sonatype.nexus.xstream/xstream

protected ConverterLookup getConverterLookup() {
  return xstream.getConverterLookup();
}

代码示例来源:origin: org.jvnet.hudson/xstream

protected ConverterLookup getConverterLookup() {
  return xstream.getConverterLookup();
}

代码示例来源:origin: ovea-deprecated/jetty-session-redis

protected ConverterLookup getConverterLookup() {
  return xstream.getConverterLookup();
}

代码示例来源:origin: apache/servicemix-bundles

protected ConverterLookup getConverterLookup() {
  return xstream.getConverterLookup();
}

代码示例来源:origin: micromata/projectforge

public XStreamSavingConverter() throws HibernateException
{
 final XStream xstream = new XStream();
 defaultConv = xstream.getConverterLookup();
 // TODO HISTORY
 //    this.ignoreFromSaving.add(PropertyDelta.class);
 //    this.ignoreFromSaving.add(SimplePropertyDelta.class);
 //    this.ignoreFromSaving.add(AssociationPropertyDelta.class);
 //    this.ignoreFromSaving.add(CollectionPropertyDelta.class);
}

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

XStream xs = new XStream();
xs.alias("base", Base.class);
NamedMapConverter c = new NamedMapConverter(StringDictionary.class, xs.getMapper(), "val", "key", String.class, null, String.class, true, false, xs.getConverterLookup());
xs.registerConverter(c);

<base>
 <values class="com.test.StringDictionary">
  <val key="123">111</val>
  <val key="abc">aaa</val>
 </values>
</base>

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

XStream xstream = new XStream();
 xstream.alias("adapter", Adapter.class);
 NamedMapConverter m = new NamedMapConverter(xstream.getMapper(), "entry", "key", String.class, "value", String.class, true, true, xstream.getConverterLookup());
 xstream.registerConverter(m);

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

private boolean hasDefaultConverter() {
  return xstream.getConverterLookup().lookupConverterForType(serializee.getRootClass())
      .equals(xstream.getConverterLookup().lookupConverterForType(Object.class));
}

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

XStream xs = new XStream();
xs.alias("base", Base.class);

xs.addDefaultImplementation(StringDictionary.class, Map.class);
NamedMapConverter c = new NamedMapConverter(xs.getMapper(), "val", "key", String.class, null, String.class, true, false, xs.getConverterLookup())
{
  public boolean canConvert(Class type)
  {
    if (type.equals(StringDictionary.class)) return true;
    else return super.canConvert(type);
  }
};
xs.registerConverter(c);

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

public void marshal(Object value, HierarchicalStreamWriter writer,
      MarshallingContext context) {
    Converter converter = xstream.getConverterLookup().lookupConverterForType(initializer.getActualClass(value));
    initializer.initialize(value);
    converter.marshal(value, writer, context);
  }
}

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

@Test
public void shouldAllowCustomXStreamRetrieval() {
  RestfulSerialization serialization = new RestfulSerialization(null, null, null, null, null, XStreamBuilderImpl.cleanInstance()) {
    @Override
    protected XStream getXStream() {
      XStream xStream = super.getXStream();
      xStream.registerConverter(new MegaConverter());
      return xStream;
    }
  };
  XStream xstream = serialization.getXStream();
  Converter converter = xstream.getConverterLookup().lookupConverterForType(CustomType.class);
  assertThat(converter.getClass(), is(typeCompatibleWith(MegaConverter.class)));
  converter = xstream.getConverterLookup().lookupConverterForType(CustomNonHMType.class);
  assertThat(converter.getClass(), is(typeCompatibleWith(MegaConverter.class)));
}

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

@Test
public void shouldReturnAnXStreamInstanceWithSupportToLinkConvertersBasedOnReflection() {
  RestfulSerializationJSON serialization = new RestfulSerializationJSON(null, null, null, null, null, XStreamBuilderImpl.cleanInstance());
  XStream xstream = serialization.getXStream();
  Converter converter = xstream.getConverterLookup().lookupConverterForType(CustomType.class);
  assertThat(converter.getClass(), is(typeCompatibleWith(LinkConverterJSON.class)));
}

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

@Test
public void shouldReturnAnXStreamInstanceWithSupportToLinkConvertersBasedOnReflection() {
  RestfulSerialization serialization = new RestfulSerialization(null, null, null, null, null, XStreamBuilderImpl.cleanInstance());
  XStream xstream = serialization.getXStream();
  Converter converter = xstream.getConverterLookup().lookupConverterForType(CustomType.class);
  assertThat(converter.getClass(), is(typeCompatibleWith(LinkConverter.class)));
}

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

@Test
public void shouldUseTheDefaultConverterForTypesThatAreNotHypermediaAware() {
  RestfulSerializationJSON serialization = new RestfulSerializationJSON(null, null, null, null, null, XStreamBuilderImpl.cleanInstance());
  XStream xstream = serialization.getXStream();
  Converter converter = xstream.getConverterLookup().lookupConverterForType(CustomNonHMType.class);
  assertThat(converter.getClass(), is(typeCompatibleWith(ReflectionConverter.class)));
}

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

@Test
public void shouldUseTheDefaultConverterForTypesThatAreNotHypermediaAware() {
  RestfulSerialization serialization = new RestfulSerialization(null, null, null, null, null, XStreamBuilderImpl.cleanInstance());
  XStream xstream = serialization.getXStream();
  Converter converter = xstream.getConverterLookup().lookupConverterForType(CustomNonHMType.class);
  assertThat(converter.getClass(), is(typeCompatibleWith(ReflectionConverter.class)));
}

相关文章