@Test(dataProvider = "buildKryoProvider") public void testKryoBuilder(BuildKryo buildKryo) { DefaultClassResolver classResolver = new DefaultClassResolver(); MapReferenceResolver referenceResolver = new MapReferenceResolver(); DefaultStreamFactory streamFactory = new DefaultStreamFactory(); InstantiatorStrategy instantiatorStrategy = new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy()); KryoCustomization enableAsm = new KryoCustomization() { @Override public void customize(Kryo kryo) { kryo.getFieldSerializerConfig().setUseAsm(true); } }; final CollectionSerializer collectionSerializer = new CollectionSerializer(); KryoCustomization registerMyCollectionSerializer = new KryoCustomization() { @Override public void customize(Kryo kryo) { kryo.addDefaultSerializer(Collection.class, collectionSerializer); } }; Kryo kryo = buildKryo.build(classResolver, referenceResolver, streamFactory, instantiatorStrategy, enableAsm, registerMyCollectionSerializer); assertSame(kryo.getClassResolver(), classResolver); assertSame(kryo.getReferenceResolver(), referenceResolver); assertSame(kryo.getStreamFactory(), streamFactory); assertSame(kryo.getInstantiatorStrategy(), instantiatorStrategy); assertTrue(kryo.isRegistrationRequired()); assertFalse(kryo.getReferences()); assertTrue(kryo.getFieldSerializerConfig().isUseAsm()); assertSame(kryo.getDefaultSerializer(Collection.class), collectionSerializer); assertFalse(kryo.getFieldSerializerConfig().isOptimizedGenerics()); }
public Kryo build() { return createKryo( classResolver != null ? classResolver : new DefaultClassResolver(), referenceResolver != null ? referenceResolver : new MapReferenceResolver(), streamFactory != null ? streamFactory : new DefaultStreamFactory() ); }
KryoBuilder { public Kryo build() { return createKryo( classResolver != null ? classResolver : new DefaultClassResolver(), referenceResolver != null ? referenceResolver : new MapReferenceResolver(), streamFactory != null ? streamFactory : new DefaultStreamFactory() ); } }
KryoBuilder { public Kryo build() { return createKryo( classResolver != null ? classResolver : new DefaultClassResolver(), referenceResolver != null ? referenceResolver : new MapReferenceResolver(), streamFactory != null ? streamFactory : new DefaultStreamFactory() ); }  }
KryoBuilder { public Kryo build() { return createKryo( classResolver != null ? classResolver : new DefaultClassResolver(), referenceResolver != null ? referenceResolver : new MapReferenceResolver(), streamFactory != null ? streamFactory : new DefaultStreamFactory() ); }  Kryo build(); KryoBuilder withClassResolver(final ClassResolver classResolver); KryoBuilder withReferenceResolver(final ReferenceResolver referenceResolver); KryoBuilder withStreamFactory(final StreamFactory streamFactory); KryoBuilder withRegistrationRequired(final boolean registrationRequired); KryoBuilder withInstantiatorStrategy(final InstantiatorStrategy instantiatorStrategy); KryoBuilder withReferences(final boolean references); KryoBuilder withKryoCustomization(final KryoCustomization kryoCustomization); KryoBuilder withOptimizedGenerics(final boolean optimizedGenerics); }
KryoBuilder { public Kryo build() { return createKryo( classResolver != null ? classResolver : new DefaultClassResolver(), referenceResolver != null ? referenceResolver : new MapReferenceResolver(), streamFactory != null ? streamFactory : new DefaultStreamFactory() ); }  Kryo build(); KryoBuilder withClassResolver(final ClassResolver classResolver); KryoBuilder withReferenceResolver(final ReferenceResolver referenceResolver); KryoBuilder withStreamFactory(final StreamFactory streamFactory); KryoBuilder withRegistrationRequired(final boolean registrationRequired); KryoBuilder withInstantiatorStrategy(final InstantiatorStrategy instantiatorStrategy); KryoBuilder withReferences(final boolean references); KryoBuilder withKryoCustomization(final KryoCustomization kryoCustomization); KryoBuilder withOptimizedGenerics(final boolean optimizedGenerics);  }