当前位置: 首页>>代码示例>>Java>>正文


Java MapperWrapper类代码示例

本文整理汇总了Java中com.thoughtworks.xstream.mapper.MapperWrapper的典型用法代码示例。如果您正苦于以下问题:Java MapperWrapper类的具体用法?Java MapperWrapper怎么用?Java MapperWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MapperWrapper类属于com.thoughtworks.xstream.mapper包,在下文中一共展示了MapperWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCloner

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
@Override
public <T> Function<T, T> createCloner(ClassLoader classLoader)
{
	final XStream xstream = new XStream() {
		@Override
		protected MapperWrapper wrapMapper(MapperWrapper next) {
			return new HibernateMapper(next);
		}
	};
	xstream.setClassLoader(classLoader);
	xstream.autodetectAnnotations(true);
	xstream.registerConverter(new HibernateProxyConverter());
	xstream.registerConverter(new HibernatePersistentCollectionConverter(xstream.getMapper()));
	xstream.registerConverter(new HibernatePersistentMapConverter(xstream.getMapper()));
	xstream.registerConverter(new HibernatePersistentSortedMapConverter(xstream.getMapper()));
	xstream.registerConverter(new HibernatePersistentSortedSetConverter(xstream.getMapper()));
	return t -> (T) xstream.fromXML(xstream.toXML(t));
}
 
开发者ID:equella,项目名称:Equella,代码行数:19,代码来源:InitialiserServiceImpl.java

示例2: getXStream

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
private synchronized XStream getXStream()
{
	if( xstream == null )
	{
		xstream = new XmlServiceImpl.ExtXStream(getClass().getClassLoader()) {
			@Override
			protected MapperWrapper wrapMapper(MapperWrapper next) {
				return new HibernateMapper(next);
			}
		};
		xstream.registerConverter(new WorkflowNodeConverter());
		xstream.registerConverter(new BaseEntityXmlConverter(registry));
		xstream.registerConverter(new HibernateProxyConverter());
		xstream.registerConverter(new HibernatePersistentCollectionConverter(xstream.getMapper()));
		xstream.registerConverter(new HibernatePersistentMapConverter(xstream.getMapper()));
	}
	return xstream;
}
 
开发者ID:equella,项目名称:Equella,代码行数:19,代码来源:ItemConverter.java

示例3: getXStream

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
private synchronized XStream getXStream()
{
	if( xstream == null )
	{
		xstream = new XmlServiceImpl.ExtXStream(getClass().getClassLoader()) {
			@Override
			protected MapperWrapper wrapMapper(MapperWrapper next) {
				return new HibernateMapper(next);
			}
		};
		xstream.registerConverter(new HibernateProxyConverter());
		xstream.registerConverter(new HibernatePersistentCollectionConverter(xstream.getMapper()));
		xstream.alias("com.tle.core.oauth.beans.OAuthToken", OAuthToken.class);
		xstream.alias("com.tle.core.oauth.beans.OAuthClient", OAuthClient.class);
		xstream.registerConverter(new ClientXStreamConverter());
	}
	return xstream;
}
 
开发者ID:equella,项目名称:Equella,代码行数:19,代码来源:OAuthTokenConverter.java

示例4: XStreamXml

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
public XStreamXml() {
    XStream prototype = new XStream();
    MapperWrapper mapperWrapper = new MapperWrapper(prototype.getMapper()) {
        /**
         * Overridden to force a class attribute to be emitted on elements whose tag name is not already the name or
         * alias of a class.
         */
        @Override
        public Class defaultImplementationOf(Class type) {
            return null;
        }
    };
    xStream = new XStream(prototype.getReflectionProvider(), new XppDriver(), prototype.getClassLoaderReference(),
            mapperWrapper);
    xStream.setMode(XStream.ID_REFERENCES);
}
 
开发者ID:commercehub-oss,项目名称:clouseau,代码行数:17,代码来源:XStreamXml.java

示例5: loadXStream

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
private static XStream loadXStream() {
  XStream xstream = new XStream(new DomDriver("UTF-8")) {
    @Override
    protected MapperWrapper wrapMapper(MapperWrapper next) {
      return new MapperWrapper(next) {
        @Override
        public boolean shouldSerializeMember(@SuppressWarnings("rawtypes") Class definedIn,
            String fieldName) {
          if (definedIn == Object.class) {
            return false;
          }
          return super.shouldSerializeMember(definedIn, fieldName);
        }
      };
    }
  };
  xstream.setMode(XStream.NO_REFERENCES);
  return xstream;
}
 
开发者ID:rquast,项目名称:swingsane,代码行数:20,代码来源:XStreamUtility.java

示例6: generateXStream

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
/**
 * {@link XStream} generator
 * <p>
 * 
 * @param hierarchicalStreamDriver
 *            {@link HierarchicalStreamDriver}
 * @return {@link XStream}
 */
private XStream generateXStream(HierarchicalStreamDriver hierarchicalStreamDriver) {
    XStream xStream = new XStream(hierarchicalStreamDriver) {
        @Override
        protected MapperWrapper wrapMapper(MapperWrapper next) {
            return new MapperWrapper(next) {
                @Override
                // avoid {@link XStream} crash when field misses
                public boolean shouldSerializeMember(Class definedIn, String fieldName) {
                    try {
                        return definedIn != Object.class || realClass(fieldName) != null;
                    }
                    catch (CannotResolveClassException cnrce) {
                        return false;
                    }
                }
            };
        }
    };
    xStream.autodetectAnnotations(true);

    return xStream;
}
 
开发者ID:owen-chen,项目名称:crawl-center,代码行数:31,代码来源:BaseParser.java

示例7: testUserDefinedMappingCanAlterFieldName

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
public void testUserDefinedMappingCanAlterFieldName() {
    xstream = new XStream() {
        protected MapperWrapper wrapMapper(MapperWrapper next) {
            return new FieldPrefixStrippingMapper(next);
        }
    };
    setupSecurity(xstream);
    xstream.alias("thing", ThingWithStupidNamingConventions.class);

    ThingWithStupidNamingConventions in = new ThingWithStupidNamingConventions("Joe", "Walnes", 10);
    String expectedXml = ""
            + "<thing>\n"
            + "  <firstName>Joe</firstName>\n" // look, no underscores!
            + "  <lastName>Walnes</lastName>\n"
            + "  <age>10</age>\n"
            + "</thing>";

    assertBothWays(in, expectedXml);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:20,代码来源:CustomMapperTest.java

示例8: testStripsPackagesUponDeserialization

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
public void testStripsPackagesUponDeserialization() {
    // obviously this isn't deserializable!
    xstream = new XStream() {
        protected MapperWrapper wrapMapper(MapperWrapper next) {
            return new PackageStrippingMapper(next);
        }
    };

    // NOTE: no aliases defined!

    String expectedXml = "" +
            "<Software>\n" +
            "  <vendor>ms</vendor>\n" +
            "  <name>word</name>\n" +
            "</Software>";
    assertEquals(expectedXml, xstream.toXML(new Software("ms", "word")));
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:18,代码来源:CustomMapperTest.java

示例9: createXStream

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
protected XStream createXStream() {
    final XStream xstream = new XStream() {

        protected MapperWrapper wrapMapper(final MapperWrapper next) {
            return new HibernateMapper(next);
        }

    };
    xstream.registerConverter(new HibernateProxyConverter());
    xstream.registerConverter(new HibernatePersistentCollectionConverter(xstream
        .getMapper()));
    xstream.registerConverter(new HibernatePersistentMapConverter(xstream.getMapper()));
    xstream
        .registerConverter(new HibernatePersistentSortedMapConverter(xstream.getMapper()));
    xstream
        .registerConverter(new HibernatePersistentSortedSetConverter(xstream.getMapper()));

    return xstream;
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:20,代码来源:AbstractHibernateAcceptanceTest.java

示例10: createStream

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
/**
 * Creates a stream instance for reading and writing.
 * 
 * @return the stream instance
 */
private static final XStream createStream() {
    XStream xstream = new XStream() {
        @Override
        protected MapperWrapper wrapMapper(MapperWrapper next) {
            return new ClassNameAliasingMapper(next);
        }
    };
    xstream.setMode(XStream.ID_REFERENCES);
    xstream.alias("model", Model.class);
    xstream.addImplicitCollection(Model.class, "models");
    xstream.registerConverter(new DelegatingTypeConverter());
    xstream.registerConverter(new EnumValueConverter());
    xstream.registerConverter(new OperationConverter());
    xstream.registerConverter(new TypeRegistryConverter());
    xstream.registerConverter(new VTLTypeConverter());
    xstream.registerConverter(new AdviceConverter());
    xstream.registerConverter(new NullValueTypeConverter());
    xstream.registerConverter(new NullValueConverter());
    xstream.registerConverter(new ReflectionOperationDescriptorConverter());
    xstream.registerConverter(new ReflectionTypeDescriptorConverter());
    xstream.registerConverter(new IVMLTypeDescriptorConverter());
    xstream.registerConverter(new IvmlComparisonOperationDescriptorConverter());
    xstream.registerConverter(new ClassWrapperConverter());
    return xstream;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:31,代码来源:XmlIo.java

示例11: getXStream

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
private XStream getXStream() {
    if (supportedClasses.isEmpty()) {
        init();
    }

    NameCoder replacer = new NoNameCoder();
    final XStream xStream = new XStream(new XppDriver(replacer)) {
        @Override
        protected MapperWrapper wrapMapper(final MapperWrapper next) {
            return new MapperWrapper(next) {
                @Override
                public boolean shouldSerializeMember(final Class definedIn, final String fieldName) {
                    if (definedIn == Object.class) {
                        return false;
                    }
                    return super.shouldSerializeMember(definedIn, fieldName);
                }
            };
        }
    };
    xStream.registerConverter(new NullDoubleConverter());
    xStream.registerConverter(new NullLongConverter());
    xStream.processAnnotations(supportedClasses.toArray(new Class[supportedClasses.size()]));
    return xStream;
}
 
开发者ID:SoftTeco,项目名称:st-toolset,代码行数:26,代码来源:AbstractXmlProcessor.java

示例12: createXStream

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
private XStream createXStream() {
    XStream xstream = new XStream() {
        @Override
        protected MapperWrapper wrapMapper(MapperWrapper next) {
            return new MapperWrapper(next) {
                @Override
                public boolean shouldSerializeMember(Class definedIn,
                                                     String fieldName) {
                    //System.out.println("definedIn: " + definedIn.getCanonicalName() + ", Object: " + Object.class.getCanonicalName());
                    if (definedIn == Object.class) {
                        return false;
                    }
                   // System.out.println(fieldName);
                    return super.shouldSerializeMember(definedIn, fieldName);
                }
            };
        }
    };
    return xstream;
}
 
开发者ID:Yunfeng,项目名称:schotel,代码行数:21,代码来源:CtripHotelServiceImpl.java

示例13: initXStream

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
/**
 * @return
 */
private XStream initXStream(final Session session, final boolean nullifyPk)
{
  final XStream xstream = new XStream() {
    @Override
    protected MapperWrapper wrapMapper(final MapperWrapper next)
    {
      return new HibernateMapper(new HibernateCollectionsMapper(next));
    }
  };
  // Converter für die Hibernate-Collections
  xstream.registerConverter(new HibernateCollectionConverter(xstream.getConverterLookup()));
  xstream.registerConverter(
      new HibernateProxyConverter(xstream.getMapper(), new PureJavaReflectionProvider(), xstream.getConverterLookup()),
      XStream.PRIORITY_VERY_HIGH);
  xstream.setMarshallingStrategy(new XStreamMarshallingStrategy(XStreamMarshallingStrategy.RELATIVE));
  init(xstream);
  return xstream;
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:22,代码来源:HibernateXmlConverter.java

示例14: McxPriceSource

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
public McxPriceSource(String currency) {
	this.currency = currency;
	x = new XStream() {
		protected MapperWrapper wrapMapper(MapperWrapper next) {
			return new MapperWrapper(next) {
				@Override
				public boolean shouldSerializeMember(@SuppressWarnings("rawtypes") Class definedIn,
						String fieldName) {
					if (definedIn == Doc.class && !"lprice".equals(fieldName)) {
						return false;
					}
					return super.shouldSerializeMember(definedIn, fieldName);
				}
			};
		}
	};
	x.processAnnotations(Doc.class);
}
 
开发者ID:kac-,项目名称:cgold,代码行数:19,代码来源:XpmPriceReader.java

示例15: XmlObjectSerializerIgnoreMissingFieldsServiceImpl

import com.thoughtworks.xstream.mapper.MapperWrapper; //导入依赖的package包/类
public XmlObjectSerializerIgnoreMissingFieldsServiceImpl() {

        xstream = new XStream(new ProxyAwareJavaReflectionProvider()) {
            @Override
            protected MapperWrapper wrapMapper(MapperWrapper next) {
                return new MapperWrapper(next) {
                    @Override
                    public boolean shouldSerializeMember(Class definedIn,
                            String fieldName) {
                        if (definedIn == Object.class) {
                            return false;
                        }
                      return super.shouldSerializeMember(definedIn, fieldName);
                   }
               };
           }
       };

		xstream.registerConverter(new ProxyConverter(xstream.getMapper(), xstream.getReflectionProvider() ));
		xstream.addDefaultImplementation(ArrayList.class, ListProxyDefaultImpl.class);
        xstream.registerConverter(new DateTimeConverter());
	}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:23,代码来源:XmlObjectSerializerIgnoreMissingFieldsServiceImpl.java


注:本文中的com.thoughtworks.xstream.mapper.MapperWrapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。