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

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

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

XStream.getMapper介绍

[英]Retrieve the Mapper. This is by default a chain of MapperWrapper.
[中]检索映射器。默认情况下,这是MapperWrapper链。

代码示例

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

protected Mapper getMapper() {
  return xstream.getMapper();
}

代码示例来源: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: jenkinsci/jenkins

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

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

/**
 * Returns the type identifier for the given {@code type}. It uses the aliasing rules configured in XStream.
 *
 * @param type The type to get the type identifier of
 * @return A String containing the type identifier of the given class
 */
private String typeIdentifierOf(Class<?> type) {
  return xStream.getMapper().serializedClass(type);
}

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

public ReferenceCollectionConverter(Class clazz, Class... subclasses) {
  super(getXStream().getMapper());
  this.clazz = clazz;
  this.subclasses = subclasses;
}

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

public ReferenceCollectionConverter(Class clazz) {
  super(getXStream().getMapper());
  this.clazz = clazz;
}

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

public KeywordListConverter() {
  super(getXStream().getMapper());
}

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

public ClassAliasingMapper getClassAliasingMapper() {
  return (ClassAliasingMapper) xs.getMapper().lookupMapperOfType(ClassAliasingMapper.class);
}

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

public BreifMapConverter() {
  super(getXStream().getMapper());
}

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

protected Class impl(Class interfce) {
  // special case case classes, they don't get registered as default implementations
  // only concrete classes do
  if (interfce == ServiceInfo.class) {
    return ServiceInfoImpl.class;
  }
  if (interfce == StoreInfo.class) {
    return StoreInfoImpl.class;
  }
  if (interfce == ResourceInfo.class) {
    return ResourceInfoImpl.class;
  }
  Class clazz = getXStream().getMapper().defaultImplementationOf(interfce);
  if (clazz == null) {
    throw new RuntimeException("No default mapping for " + interfce);
  }
  return clazz;
}

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

args[i] = xstream;
else if(p[i]== Mapper.class)
  args[i] = xstream.getMapper();
else
  throw new InstantiationError("Unrecognized constructor parameter: "+p[i]);

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

@Override
public Class classForType(SerializedType type) {
  if (SerializedType.emptyType().equals(type)) {
    return Void.class;
  }
  try {
    return xStream.getMapper().realClass(type.getName());
  } catch (CannotResolveClassException e) {
    return UnknownSerializedType.class;
  }
}

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

/**
 * Instantiate a {@link AbstractXStreamSerializer} based on the fields contained in the {@link Builder}.
 *
 * @param builder the {@link Builder} used to instantiate a {@link AbstractXStreamSerializer} instance
 */
protected AbstractXStreamSerializer(Builder builder) {
  builder.validate();
  this.charset = builder.charset;
  this.xStream = builder.xStream;
  this.converter = builder.converter;
  this.revisionResolver = builder.revisionResolver;
  if (converter instanceof ChainingConverter) {
    registerConverters((ChainingConverter) converter);
  }
  xStream.addImmutableType(UUID.class, true);
  // Message serialization
  xStream.alias("domain-event", GenericDomainEventMessage.class);
  xStream.alias("event", GenericEventMessage.class);
  xStream.alias("command", GenericCommandMessage.class);
  // For backward compatibility
  xStream.alias("uuid", UUID.class);
  xStream.alias("meta-data", MetaData.class);
  xStream.registerConverter(new MetaDataConverter(xStream.getMapper()));
}

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

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

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

private static XStream createXStream(boolean json) {
    final XStream xstream;
    if (json) {
      // format json
      xstream = new XStream(new JsonHierarchicalStreamDriver());
      xstream.setMode(XStream.NO_REFERENCES);
    } else {
      // sinon format xml, utilise la dépendance XPP3 par défaut
      xstream = new XStream();
    }
    for (final Map.Entry<String, Class<?>> entry : XStreamAlias.getMap().entrySet()) {
      xstream.alias(entry.getKey(), entry.getValue());
    }
    final MapConverter mapConverter = new MapConverter(xstream.getMapper()) {
      /** {@inheritDoc} */
      @SuppressWarnings("rawtypes")
      @Override
      public boolean canConvert(Class type) {
        return true; // Counter.requests est bien une map
      }
    };
    xstream.registerLocalConverter(Counter.class, "requests", mapConverter);
    xstream.registerLocalConverter(Counter.class, "rootCurrentContextsByThreadId",
        mapConverter);
    return xstream;
  }
}

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

private XStreamPersister buildGlobalPersister() {
  XStreamPersister xp = buildPersister();
  xp.getXStream().alias("security", SecurityManagerConfig.class);
  xp.getXStream().alias("masterPassword", MasterPasswordConfig.class);
  xp.getXStream()
      .registerLocalConverter(
          SecurityManagerConfig.class,
          "filterChain",
          new FilterChainConverter(xp.getXStream().getMapper()));
  // The field anonymousAuth is deprecated
  xp.getXStream().omitField(SecurityManagerConfig.class, "anonymousAuth");
  return xp;
}

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

impl(CoverageInfo.class),
    "supportedFormats",
    new LaxCollectionConverter(xs.getMapper()));
xs.registerLocalConverter(
    impl(CoverageInfo.class), "requestSRS", new LaxCollectionConverter(xs.getMapper()));
xs.registerLocalConverter(
    impl(CoverageInfo.class),
    "responseSRS",
    new LaxCollectionConverter(xs.getMapper()));
xs.registerLocalConverter(
    impl(CoverageInfo.class),
    "interpolationMethods",
    new LaxCollectionConverter(xs.getMapper()));
xs.registerLocalConverter(
    impl(CoverageInfo.class), "dimensions", new LaxCollectionConverter(xs.getMapper()));
xs.registerConverter(new LayerGroupInfoConverter());
xs.registerConverter(new GridGeometry2DConverter());
xs.registerConverter(new ProxyCollectionConverter(xs.getMapper()));
xs.registerConverter(new VirtualTableConverter());
xs.registerConverter(new KeywordInfoConverter());
    impl(SettingsInfo.class),
    "metadata",
    new SettingsTolerantMapConverter(xs.getMapper(), MetadataMap.class));
xs.registerConverter(new MeasureConverter());
xs.registerConverter(new MultimapConverter(xs.getMapper()));

相关文章