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

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

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

XStream.omitField介绍

[英]Prevents a field from being serialized. To omit a field you must always provide the declaring type and not necessarily the type that is converted.
[中]防止字段被序列化。要省略字段,必须始终提供声明类型,而不必提供转换的类型。

代码示例

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

public void setHideFeatureTypeAttributes() {
  xs.omitField(FeatureTypeInfoImpl.class, "attributes");
}

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

public void setExcludeIds() {
  xs.omitField(impl(WorkspaceInfo.class), "id");
  xs.omitField(impl(NamespaceInfo.class), "id");
  xs.omitField(impl(StoreInfo.class), "id");
  xs.omitField(impl(StyleInfo.class), "id");
  xs.omitField(impl(ResourceInfo.class), "id");
  xs.omitField(impl(LayerInfo.class), "id");
  xs.omitField(impl(LayerGroupInfo.class), "id");
  xs.omitField(impl(AttributeTypeInfo.class), "id");
  xs.omitField(impl(ServiceInfo.class), "id");
}

代码示例来源:origin: spring-projects/spring-framework

String[] fields = StringUtils.commaDelimitedListToStringArray(value);
for (String field : fields) {
  xstream.omitField(key, field);

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

xs.omitField(impl(GeoServerInfo.class), "clientProperties");
xs.omitField(impl(GeoServerInfo.class), "geoServer");
xs.registerLocalConverter(
    impl(GeoServerInfo.class), "metadata", new MetadataMapConverter());
xs.omitField(impl(ServiceInfo.class), "clientProperties");
xs.omitField(impl(ServiceInfo.class), "geoServer");
xs.registerLocalConverter(
    impl(ServiceInfo.class), "workspace", new ReferenceConverter(WorkspaceInfo.class));
xs.omitField(impl(Catalog.class), "resourcePool");
xs.omitField(impl(Catalog.class), "resourceLoader");
xs.omitField(impl(Catalog.class), "listeners");
xs.omitField(impl(Catalog.class), "LOGGER");
xs.omitField(impl(DefaultCatalogFacade.class), "catalog");
xs.omitField(impl(DefaultCatalogFacade.class), "resources");
xs.omitField(impl(DefaultCatalogFacade.class), "layers");
xs.omitField(impl(DefaultCatalogFacade.class), "maps");
xs.omitField(impl(DefaultCatalogFacade.class), "layerGroups");
xs.omitField(impl(WorkspaceInfo.class), "_default");
xs.registerLocalConverter(
    impl(WorkspaceInfo.class), "metadata", new MetadataMapConverter());
xs.omitField(impl(NamespaceInfo.class), "catalog");
xs.omitField(impl(NamespaceInfo.class), "_default");
xs.registerLocalConverter(
    impl(NamespaceInfo.class), "metadata", new MetadataMapConverter());

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

@Override
protected void omitFields(final XStream xstream) {
  // omit not serializable fields
  xstream.omitField(GeoServer.class, "geoServer");
}

代码示例来源:origin: org.geoserver/gs-jms-geoserver

@Override
protected void omitFields(final XStream xstream) {
  // omit not serializable fields
  xstream.omitField(GeoServer.class, "geoServer");
}

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

/**
 * omit not serializable fields
 * @see {@link XStream}
 */
private void omitFields() {
  // omit not serializable fields
  xstream.omitField(CatalogImpl.class, "listeners");
  xstream.omitField(CatalogImpl.class, "facade");
  xstream.omitField(CatalogImpl.class, "resourcePool");
  xstream.omitField(CatalogImpl.class, "resourceLoader");
}

代码示例来源:origin: org.geoserver/gs-jms-geoserver

/**
 * omit not serializable fields
 * @see {@link XStream}
 */
private void omitFields() {
  // omit not serializable fields
  xstream.omitField(CatalogImpl.class, "listeners");
  xstream.omitField(CatalogImpl.class, "facade");
  xstream.omitField(CatalogImpl.class, "resourcePool");
  xstream.omitField(CatalogImpl.class, "resourceLoader");
}

代码示例来源:origin: org.springframework.ws/spring-oxm

/**
 * Adds an omitted field for the given type.
 *
 * @param type      the type to be containing the field
 * @param fieldName field to omitt
 * @see XStream#omitField(Class, String)
 */
public void addOmittedField(Class type, String fieldName) {
  getXStream().omitField(type, fieldName);
}

代码示例来源:origin: com.haulmont.cuba/cuba-core

protected XStream createXStream() {
  XStream xStream = new CubaXStream();
  XStream.setupDefaultSecurity(xStream);
  xStream.allowTypeHierarchy(Serializable.class);
  //createTs and createdBy removed from BaseGenericIdEntity,
  //and import from old versions (platform 6.2) is performed with errors
  //so omit field processing
  xStream.omitField(BaseGenericIdEntity.class, "createTs");
  xStream.omitField(BaseGenericIdEntity.class, "createdBy");
  return xStream;
}

代码示例来源:origin: org.powermock/powermock-classloading-xstream

/**
 * Clone using the supplied ClassLoader.
 * @param classLoader - the classloader to loaded cloned classes.
 */
public DeepCloner(ClassLoader classLoader) {
  xStream = new XStream();
  disableSecurity();
  xStream.omitField(SingleClassloaderExecutor.class, "classloader");
  xStream.setClassLoader(classLoader);
}

代码示例来源:origin: org.tinygroup/fileresolver

private void processPropertyOmit(XStream xStream,
    XStreamClassAlias classAlias, Class<?> clazz) {
  for (XStreamPropertyOmit propertyOmit : classAlias.getPropertyOmits()) {
    xStream.omitField(clazz, propertyOmit.getAttributeName());
  }
}

代码示例来源:origin: net.exogeni.orca.core/shirako

@Override
public void initialize() throws Exception
{
  if (!initialized){
    super.initialize();
    initialize(xsmForSigning);
    xsmForSigning.omitField(SignedResourceDelegation.class, "signature");
    initialized = true;
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.webstudio

private IRulesDeploySerializer getSerializer(SupportedVersion version) {
    BaseRulesDeploySerializer serializer = (BaseRulesDeploySerializer) serializerFactory.getSerializer(version);
    // We process the "configuration" field ourself
    serializer.getXstream().omitField(RulesDeploy.class, "configuration");
    return serializer;
  }
}

代码示例来源:origin: org.geoserver.community/gs-status-monitoring

@Override
public void configurePersister(XStreamPersister persister, XStreamMessageConverter converter) {
  XStream xs = persister.getXStream();
  xs.alias("metric", MetricValue.class);
  xs.alias("metrics", Metrics.class);
  xs.omitField(MetricValue.class, "value");
  xs.registerConverter(new ValueHolderConverter());
  xs.aliasField("value", MetricValue.class, "holder");
  xs.addImplicitCollection(Metrics.class, "metrics");
}

代码示例来源:origin: openl-tablets/openl-tablets

public XmlRulesDescriptorSerializer_v5_11() {
    super(new RulesDeployVersionConverter());
    xstream.ignoreUnknownElements();
    xstream.omitField(RulesDeploy_v5_11.class, "log");

    xstream.setMode(XStream.NO_REFERENCES);

    xstream.aliasType(RULES_DEPLOY_DESCRIPTOR_TAG, RulesDeploy_v5_11.class);
  }
}

代码示例来源:origin: openl-tablets/openl-tablets

public XmlRulesDescriptorSerializer_v5_14() {
    super(new RulesDeployVersionConverter());
    xstream.ignoreUnknownElements();
    xstream.omitField(RulesDeploy_v5_14.class, "log");

    xstream.setMode(XStream.NO_REFERENCES);

    xstream.aliasType("publisher", RulesDeploy_v5_14.PublisherType.class);
    xstream.aliasType(RULES_DEPLOY_DESCRIPTOR_TAG, RulesDeploy_v5_14.class);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.webstudio

public XmlRulesDescriptorSerializer_v5_14() {
    super(new RulesDeployVersionConverter());
    xstream.ignoreUnknownElements();
    xstream.omitField(RulesDeploy_v5_14.class, "log");

    xstream.setMode(XStream.NO_REFERENCES);

    xstream.aliasType("publisher", RulesDeploy_v5_14.PublisherType.class);
    xstream.aliasType(RULES_DEPLOY_DESCRIPTOR_TAG, RulesDeploy_v5_14.class);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.webstudio

public XmlRulesDescriptorSerializer_v5_16() {
    super(new RulesDeployVersionConverter());
    xstream.ignoreUnknownElements();
    xstream.omitField(RulesDeploy_v5_16.class, "log");

    xstream.setMode(XStream.NO_REFERENCES);

    xstream.aliasType("publisher", RulesDeploy_v5_16.PublisherType.class);
    xstream.aliasType(RULES_DEPLOY_DESCRIPTOR_TAG, RulesDeploy_v5_16.class);
    xstream.aliasType(MODULE_NAME, RulesDeploy_v5_16.WildcardPattern.class);

    xstream.aliasField(LAZY_MODULES_FOR_COMPILATION, RulesDeploy_v5_16.class, "lazyModulesForCompilationPatterns");

    xstream.aliasField("name", RulesDeploy_v5_16.WildcardPattern.class, "value");
    xstream.useAttributeFor(RulesDeploy_v5_16.WildcardPattern.class, "value");
  }
}

相关文章