/** * Overridable method, used to create a non-blueprint instances from the blueprint. * This is needed to retain state during serialization. */ protected StdSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf) { return new StdSerializerProvider(config, this, jsf); }
/** * Overridable method, used to create a non-blueprint instances from the blueprint. * This is needed to retain state during serialization. */ protected StdSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf) { return new StdSerializerProvider(config, this, jsf); }
new DeserializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR, STD_VISIBILITY_CHECKER, null, null, _typeFactory, null); _serializerProvider = (sp == null) ? new StdSerializerProvider() : sp; _deserializerProvider = (dp == null) ? new StdDeserializerProvider() : dp;
/** * Overridable method, used to create a non-blueprint instances from the blueprint. * This is needed to retain state during serialization. */ protected StdSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf) { return new StdSerializerProvider(config, this, jsf); }
/** * Overridable method, used to create a non-blueprint instances from the blueprint. * This is needed to retain state during serialization. */ protected StdSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf) { return new StdSerializerProvider(config, this, jsf); }
/** * Overridable method, used to create a non-blueprint instances from the blueprint. * This is needed to retain state during serialization. */ protected StdSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf) { return new StdSerializerProvider(config, this, jsf); }
/** * Overridable method, used to create a non-blueprint instances from the blueprint. * This is needed to retain state during serialization. */ protected StdSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf) { return new StdSerializerProvider(config, this, jsf); }
/** * Overridable method, used to create a non-blueprint instances from the blueprint. * This is needed to retain state during serialization. */ protected StdSerializerProvider createInstance(JsonSerializerFactory jsf) { return new StdSerializerProvider(this, jsf); }
new DeserializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR, STD_VISIBILITY_CHECKER, null, null, _typeFactory, null); _serializerProvider = (sp == null) ? new StdSerializerProvider() : sp; _deserializerProvider = (dp == null) ? new StdDeserializerProvider() : dp;
public JavaTypeMapper(JsonFactory jf, JsonSerializerProvider p, JsonSerializerFactory jsf) { _jsonFactory = (jf == null) ? new JsonFactory() : jf; _serializerProvider = (p == null) ? new StdSerializerProvider() : p; _serializerFactory = (jsf == null) ? BeanSerializerFactory.instance : jsf; }
ObjectMapper mapper = new ObjectMapper(); StdSerializerProvider provider = new StdSerializerProvider(); provider.setKeySerializer(new KeySerializer(A.class)); mapper.setSerializerProvider(provider); StringWriter out = new StringWriter(); mapper.writeValue(out, c); String json = out.toString(); System.out.println("JSON= "+json); C c2 = mapper.readValue(json, C.class); System.out.print("C2= "); StringWriter outC2 = new StringWriter(); mapper.writeValue(outC2, c2); System.out.println(outC2.toString());
ObjectMapper objMapper = new ObjectMapper(); StdSerializerProvider sp = new StdSerializerProvider(); sp.setNullValueSerializer(new NullSerializer()); objMapper.setSerializerProvider(sp);
/** * * @param jf JsonFactory to use: if null, a new {@link MappingJsonFactory} will be constructed * @param sp SerializerProvider to use: if null, a {@link StdSerializerProvider} will be constructed * @param dp DeserializerProvider to use: if null, a {@link StdDeserializerProvider} will be constructed * @param sconfig Serialization configuration to use; if null, basic {@link SerializationConfig} * will be constructed * @param dconfig Deserialization configuration to use; if null, basic {@link DeserializationConfig} * will be constructed */ public ObjectMapper(JsonFactory jf, SerializerProvider sp, DeserializerProvider dp, SerializationConfig sconfig, DeserializationConfig dconfig) { /* 02-Mar-2009, tatu: Important: we MUST default to using * the mapping factory, otherwise tree serialization will * have problems with POJONodes. * 03-Jan-2010, tatu: and obviously we also must pass 'this', * to create actual linking. */ _jsonFactory = (jf == null) ? new MappingJsonFactory(this) : jf; _serializationConfig = (sconfig == null) ? new SerializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR) : sconfig; _deserializationConfig = (dconfig == null) ? new DeserializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR) : dconfig; _serializerProvider = (sp == null) ? new StdSerializerProvider() : sp; _deserializerProvider = (dp == null) ? new StdDeserializerProvider() : dp; // Default serializer factory is stateless, can just assign _serializerFactory = BeanSerializerFactory.instance; // and use standard JsonNodeFactory initially _nodeFactory = JsonNodeFactory.instance; }
new DeserializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR, STD_VISIBILITY_CHECKER, null, null, _typeFactory, null); _serializerProvider = (sp == null) ? new StdSerializerProvider() : sp; _deserializerProvider = (dp == null) ? new StdDeserializerProvider() : dp;
new DeserializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR, STD_VISIBILITY_CHECKER, null, null, _typeFactory, null); _serializerProvider = (sp == null) ? new StdSerializerProvider() : sp; _deserializerProvider = (dp == null) ? new StdDeserializerProvider() : dp;
new DeserializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR, STD_VISIBILITY_CHECKER, null, null, _typeFactory, null); _serializerProvider = (sp == null) ? new StdSerializerProvider() : sp; _deserializerProvider = (dp == null) ? new StdDeserializerProvider() : dp;