@Override public PropertySerializerMap newWith(Class<?> type, JsonSerializer<Object> serializer) { // Ok: let's just create generic one TypeAndSerializer[] ts = new TypeAndSerializer[2]; ts[0] = new TypeAndSerializer(_type1, _serializer1); ts[1] = new TypeAndSerializer(_type2, _serializer2); return new Multi(ts); } }
public JsonSerializer<Object> typedValueSerializer(JavaType type) { _cacheKey.resetTyped(type); return _map.find(_cacheKey); }
/** * Factory method for creating the "blueprint" lookup map. Such map * can not be used as is but just shared: to get an actual usable * instance, {@link #instance} has to be called first. */ public static ReadOnlyClassToSerializerMap from(HashMap<TypeKey, JsonSerializer<Object>> src) { return new ReadOnlyClassToSerializerMap(new JsonSerializerMap(src)); }
public JsonSerializer<Object> untypedValueSerializer(Class<?> cls) { _cacheKey.resetUntyped(cls); return _map.find(_cacheKey); }
/** * Method called if initial lookup fails; will both find serializer * and construct new map instance if warranted, and return both * @throws JsonMappingException */ public final SerializerAndMapResult findAndAddSerializer(Class<?> type, SerializerProvider provider, BeanProperty property) throws JsonMappingException { JsonSerializer<Object> serializer = provider.findValueSerializer(type, property); return new SerializerAndMapResult(serializer, newWith(type, serializer)); }
public void resetTyped(JavaType type) { _type = type; _class = null; _isTyped = true; _hashCode = hash(type, true); }
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map, JavaType type, SerializerProvider provider) throws JsonMappingException { PropertySerializerMap.SerializerAndMapResult result = map.findAndAddSerializer(type, provider, _property); if (map != result.map) { _dynamicValueSerializers = result.map; } return result.serializer; }
/** * Factory method to construct filter that filters out all properties <b>except</b> * ones includes in set */ public static SimpleBeanPropertyFilter filterOutAllExcept(Set<String> properties) { return new FilterExceptFilter(properties); }
public ObjectArraySerializer(JavaType elemType, boolean staticTyping, TypeSerializer vts, BeanProperty property, JsonSerializer<Object> elementSerializer) { super(Object[].class, vts, property); _elementType = elemType; _staticTyping = staticTyping; _dynamicSerializers = PropertySerializerMap.emptyMap(); _elementSerializer = elementSerializer; }
@Override public PropertySerializerMap newWith(Class<?> type, JsonSerializer<Object> serializer) { return new Single(type, serializer); } }
@Override public PropertySerializerMap newWith(Class<?> type, JsonSerializer<Object> serializer) { return new Double(_type, _serializer, type, serializer); } }
/** * Method called create an instance that handles details of unwrapping * contained value. * * @since 1.9 */ public BeanPropertyWriter unwrappingWriter() { return new UnwrappingBeanPropertyWriter(this); }
public JsonSerializer<Object> typedValueSerializer(Class<?> cls) { _cacheKey.resetTyped(cls); return _map.find(_cacheKey); }
public JsonSerializer<Object> untypedValueSerializer(JavaType type) { _cacheKey.resetUntyped(type); return _map.find(_cacheKey); } }
public TypeKey(Class<?> key, boolean typed) { _class = key; _type = null; _isTyped = typed; _hashCode = hash(key, typed); }
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map, Class<?> type, SerializerProvider provider) throws JsonMappingException { PropertySerializerMap.SerializerAndMapResult result = map.findAndAddSerializer(type, provider, _property); // did we get a new map of serializers? If so, start using it if (map != result.map) { _dynamicValueSerializers = result.map; } return result.serializer; }
public TypeKey(JavaType key, boolean typed) { _type = key; _class = null; _isTyped = typed; _hashCode = hash(key, typed); }
public void resetUntyped(JavaType type) { _type = type; _class = null; _isTyped = false; _hashCode = hash(type, false); }
public void resetTyped(Class<?> cls) { _type = null; _class = cls; _isTyped = true; _hashCode = hash(cls, true); }
public void resetUntyped(Class<?> cls) { _type = null; _class = cls; _isTyped = false; _hashCode = hash(cls, false); }