• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java InstantiatorStrategy类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: treeNode

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
@Test
public void treeNode() {
    final Result<DecisionTreeRuleSet> result = (new CommisionRuleSetSupplier()).get();
    EhSupport.ensure(result.isSuccess(), "Could not create decision tree");
    final DecisionTreeRuleSet ruleSet = result.getData();

    final TreeNode node = DecisionTreeFactory.constructDecisionTree(ruleSet, DecisionTreeType.SINGLE);

    final Kryo kryo = new Kryo();
    // no default no-arg constructors
    kryo.setInstantiatorStrategy(new StdInstantiatorStrategy());

    final InstantiatorStrategy defaultInstantiatorStrategy = new Kryo.DefaultInstantiatorStrategy();
    kryo.getRegistration(ArrayList.class)
            .setInstantiator(defaultInstantiatorStrategy.newInstantiatorOf(ArrayList.class));
    kryo.getRegistration(HashSet.class)
            .setInstantiator(defaultInstantiatorStrategy.newInstantiatorOf(HashSet.class));
    UnmodifiableCollectionsSerializer.registerSerializers(kryo);

    final ByteArrayOutputStream out = new ByteArrayOutputStream();
    final Output output = new Output(out);
    kryo.writeObject(output, node);
    output.flush();
    output.close();

    final ByteArrayInputStream inputStream = new ByteArrayInputStream(out.toByteArray());
    final Input kryoInput = new Input(inputStream);
    final TreeNode tree = kryo.readObject(kryoInput, BaseTreeNode.class);

    final SingleDecisionTreeFactoryTest test = new SingleDecisionTreeFactoryTest();
    test.checkTreeNode(tree, ruleSet);

    assertEquals(node, tree);
}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:35,代码来源:TreeSerializationTest.java


示例2: ObjenesisBase

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
/**
 * Flexible constructor allowing to pick the strategy and if caching should be used
 *
 * @param strategy Strategy to use
 * @param useCache If {@link ObjectInstantiator}s should be cached
 */
public ObjenesisBase(InstantiatorStrategy strategy, boolean useCache) {
   if(strategy == null) {
      throw new IllegalArgumentException("A strategy can't be null");
   }
   this.strategy = strategy;
   this.cache = useCache ? new ConcurrentHashMap<String, ObjectInstantiator<?>>() : null;
}
 
开发者ID:easymock,项目名称:objenesis,代码行数:14,代码来源:ObjenesisBase.java


示例3: testInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
@Test
public void testInstantiatorStrategy() throws Exception {
    assertNotNull(factory.getInstantiatorStrategy());

    InstantiatorStrategy strategy = new StdInstantiatorStrategy();

    factory.setInstantiatorStrategy(strategy);

    assertSame(strategy, factory.getInstantiatorStrategy());

    factory.setInstantiatorStrategy(null);

    assertNotNull(factory.createCodec());

    assertNull(factory.getInstantiatorStrategy());

    assertSame(factory, factory.withInstantiatorStrategy(strategy));

    assertSame(strategy, factory.getInstantiatorStrategy());

    assertNotNull(factory.createCodec());
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:23,代码来源:KryoCodecFactoryTest.java


示例4: getInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
public InstantiatorStrategy getInstantiatorStrategy () {
	return strategy;
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:4,代码来源:Kryo.java


示例5: DefaultInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
public DefaultInstantiatorStrategy (InstantiatorStrategy fallbackStrategy) {
	this.fallbackStrategy = fallbackStrategy;
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:4,代码来源:Kryo.java


示例6: setFallbackInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
public void setFallbackInstantiatorStrategy (final InstantiatorStrategy fallbackStrategy) {
	this.fallbackStrategy = fallbackStrategy;
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:4,代码来源:Kryo.java


示例7: getFallbackInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
public InstantiatorStrategy getFallbackInstantiatorStrategy () {
	return fallbackStrategy;
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:4,代码来源:Kryo.java


示例8: getInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
public InstantiatorStrategy getInstantiatorStrategy() {
	return strategy;
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:4,代码来源:Kryo.java


示例9: setFallbackInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
public void setFallbackInstantiatorStrategy(final InstantiatorStrategy fallbackStrategy) {
	this.fallbackStrategy = fallbackStrategy;
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:4,代码来源:Kryo.java


示例10: getFallbackInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
public InstantiatorStrategy getFallbackInstantiatorStrategy() {
	return fallbackStrategy;
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:4,代码来源:Kryo.java


示例11: DefaultInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
public DefaultInstantiatorStrategy (InstantiatorStrategy fallbackStrategy) {
  this.fallbackStrategy = fallbackStrategy;
}
 
开发者ID:apache,项目名称:metron,代码行数:4,代码来源:SerDeUtils.java


示例12: setFallbackInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
public void setFallbackInstantiatorStrategy (final InstantiatorStrategy fallbackStrategy) {
  this.fallbackStrategy = fallbackStrategy;
}
 
开发者ID:apache,项目名称:metron,代码行数:4,代码来源:SerDeUtils.java


示例13: getFallbackInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
public InstantiatorStrategy getFallbackInstantiatorStrategy () {
  return fallbackStrategy;
}
 
开发者ID:apache,项目名称:metron,代码行数:4,代码来源:SerDeUtils.java


示例14: getInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
/**
 * Returns the instantiator strategy (see {@link #setInstantiatorStrategy(InstantiatorStrategy)}).
 *
 * @return Instantiator strategy.
 */
public InstantiatorStrategy getInstantiatorStrategy() {
    return instantiatorStrategy;
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:9,代码来源:KryoCodecFactory.java


示例15: setInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
/**
 * Sets instantiator strategy. Such strategy will be registered via {@link Kryo#setInstantiatorStrategy(InstantiatorStrategy)}.
 *
 * <p>
 * By default this parameter is set to {@link DefaultInstantiatorStrategy} with a fallback to {@link StdInstantiatorStrategy}.
 * </p>
 *
 * @param instantiatorStrategy Instantiator strategy.
 */
public void setInstantiatorStrategy(InstantiatorStrategy instantiatorStrategy) {
    this.instantiatorStrategy = instantiatorStrategy;
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:13,代码来源:KryoCodecFactory.java


示例16: withInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
/**
 * Fluent-style version of {@link #setInstantiatorStrategy(InstantiatorStrategy)}.
 *
 * @param instantiatorStrategy Instantiator strategy.
 *
 * @return This instance.
 */
public KryoCodecFactory<T> withInstantiatorStrategy(InstantiatorStrategy instantiatorStrategy) {
    setInstantiatorStrategy(instantiatorStrategy);

    return this;
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:13,代码来源:KryoCodecFactory.java


示例17: setInstantiatorStrategy

import org.objenesis.strategy.InstantiatorStrategy; //导入依赖的package包/类
/** Sets the strategy used by {@link #newInstantiator(Class)} for creating objects. See {@link StdInstantiatorStrategy} to
 * create objects via without calling any constructor. See {@link SerializingInstantiatorStrategy} to mimic Java's built-in
 * serialization.
 * @param strategy May be null. */
public void setInstantiatorStrategy (InstantiatorStrategy strategy) {
	this.strategy = strategy;
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:8,代码来源:Kryo.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Kind类代码示例发布时间:2022-05-22
下一篇:
Java IntrospectedTableMyBatis3SimpleImpl类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap