GenericSingleClassLoaderSofaSerializerFactory extends SingleClassLoaderSofaSerializerFactory { @Override public Serializer getSerializer(Class cl) throws HessianProtocolException { if (GenericObject.class == cl) { return GenericObjectSerializer.getInstance(); } if (GenericArray.class == cl) { return GenericArraySerializer.getInstance(); } if (GenericCollection.class == cl) { return GenericCollectionSerializer.getInstance(); } if (GenericMap.class == cl) { return GenericMapSerializer.getInstance(); } if (GenericClass.class == cl) { return GenericClassSerializer.getInstance(); } return super.getSerializer(cl); }  @Override Serializer getSerializer(Class cl); @Override Deserializer getDeserializer(String type);  }
@Test public void getSerializer() throws Exception { Assert.assertEquals(factory.getSerializer(GenericObject.class).getClass(), GenericObjectSerializer.class); Assert.assertEquals(factory.getSerializer(GenericArray.class).getClass(), GenericArraySerializer.class); Assert.assertEquals(factory.getSerializer(GenericCollection.class).getClass(), GenericCollectionSerializer.class); Assert.assertEquals(factory.getSerializer(GenericMap.class).getClass(), GenericMapSerializer.class); Assert.assertEquals(factory.getSerializer(GenericClass.class).getClass(), GenericClassSerializer.class); }