protected MapSerializer(HashSet<String> ignoredEntries, JavaType keyType, JavaType valueType, boolean valueTypeIsStatic, TypeSerializer vts, JsonSerializer<Object> keySerializer, JsonSerializer<Object> valueSerializer, BeanProperty property) { super(Map.class, false); _property = property; _ignoredEntries = ignoredEntries; _keyType = keyType; _valueType = valueType; _valueTypeIsStatic = valueTypeIsStatic; _valueTypeSerializer = vts; _keySerializer = keySerializer; _valueSerializer = valueSerializer; _dynamicValueSerializers = PropertySerializerMap.emptyMap(); }
protected AsArraySerializer(Class<?> paramClass, JavaType paramJavaType, boolean paramBoolean, TypeSerializer paramTypeSerializer, BeanProperty paramBeanProperty, JsonSerializer<Object> paramJsonSerializer) { super(false); this._elementType = paramJavaType; boolean bool1; if (!paramBoolean) { bool1 = false; if (paramJavaType != null) { boolean bool2 = paramJavaType.isFinal(); bool1 = false; if (!bool2); } } else { bool1 = true; } this._staticTyping = bool1; this._valueTypeSerializer = paramTypeSerializer; this._property = paramBeanProperty; this._elementSerializer = paramJsonSerializer; this._dynamicSerializers = PropertySerializerMap.emptyMap(); }
public BeanPropertyWriter(AnnotatedMember paramAnnotatedMember, Annotations paramAnnotations, SerializedString paramSerializedString, JavaType paramJavaType1, JsonSerializer<Object> paramJsonSerializer, TypeSerializer paramTypeSerializer, JavaType paramJavaType2, Method paramMethod, Field paramField, boolean paramBoolean, Object paramObject) { this._member = paramAnnotatedMember; this._contextAnnotations = paramAnnotations; this._name = paramSerializedString; this._declaredType = paramJavaType1; this._serializer = paramJsonSerializer; if (paramJsonSerializer == null); for (PropertySerializerMap localPropertySerializerMap = PropertySerializerMap.emptyMap(); ; localPropertySerializerMap = null) { this._dynamicSerializers = localPropertySerializerMap; this._typeSerializer = paramTypeSerializer; this._cfgSerializationType = paramJavaType2; this._accessorMethod = paramMethod; this._field = paramField; this._suppressNulls = paramBoolean; this._suppressableValue = paramObject; return; } }
protected AsArraySerializerBase(Class<?> paramClass, JavaType paramJavaType, boolean paramBoolean, TypeSerializer paramTypeSerializer, BeanProperty paramBeanProperty, JsonSerializer<Object> paramJsonSerializer) { super(paramClass, false); this._elementType = paramJavaType; boolean bool1; if (!paramBoolean) { bool1 = false; if (paramJavaType != null) { boolean bool2 = paramJavaType.isFinal(); bool1 = false; if (!bool2); } } else { bool1 = true; } this._staticTyping = bool1; this._valueTypeSerializer = paramTypeSerializer; this._property = paramBeanProperty; this._elementSerializer = paramJsonSerializer; this._dynamicSerializers = PropertySerializerMap.emptyMap(); }
@Override public void serializeAsField(Object bean, JsonGenerator jgen, SerializerProvider prov) throws Exception { // _name is final so we have to do a little bit of trickery to change the field name. Object value = get(bean); // Null handling is bit different, check that first if (value == null) { if (!_suppressNulls) { jgen.writeFieldName(_name); prov.defaultSerializeNull(jgen); } return; } // For non-nulls, first: simple check for direct cycles if (value == bean) { _reportSelfReference(bean); } if (_suppressableValue != null && _suppressableValue.equals(value)) { return; } JsonSerializer<Object> ser = _serializer; if (ser == null) { Class<?> cls = value.getClass(); PropertySerializerMap map = _dynamicSerializers; ser = map.serializerFor(cls); if (ser == null) { ser = _findAndAddDynamic(map, cls, prov); } } jgen.writeFieldName(UniqueId.UNIQUE_NAME); if (_typeSerializer == null) { ser.serialize(value, jgen, prov); } else { ser.serializeWithType(value, jgen, prov, _typeSerializer); } }
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; }
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; }
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap paramPropertySerializerMap, Class<?> paramClass, SerializerProvider paramSerializerProvider) throws JsonMappingException { PropertySerializerMap.SerializerAndMapResult localSerializerAndMapResult = paramPropertySerializerMap.findAndAddSerializer(paramClass, paramSerializerProvider, this._property); if (paramPropertySerializerMap != localSerializerAndMapResult.map) this._dynamicSerializers = localSerializerAndMapResult.map; return localSerializerAndMapResult.serializer; }
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap paramPropertySerializerMap, JavaType paramJavaType, SerializerProvider paramSerializerProvider) throws JsonMappingException { PropertySerializerMap.SerializerAndMapResult localSerializerAndMapResult = paramPropertySerializerMap.findAndAddSerializer(paramJavaType, paramSerializerProvider, this._property); if (paramPropertySerializerMap != localSerializerAndMapResult.map) this._dynamicSerializers = localSerializerAndMapResult.map; return localSerializerAndMapResult.serializer; }
protected MapSerializer(HashSet<String> paramHashSet, JavaType paramJavaType1, JavaType paramJavaType2, boolean paramBoolean, TypeSerializer paramTypeSerializer, JsonSerializer<Object> paramJsonSerializer1, JsonSerializer<Object> paramJsonSerializer2, BeanProperty paramBeanProperty) { super(Map.class, false); this._property = paramBeanProperty; this._ignoredEntries = paramHashSet; this._keyType = paramJavaType1; this._valueType = paramJavaType2; this._valueTypeIsStatic = paramBoolean; this._valueTypeSerializer = paramTypeSerializer; this._keySerializer = paramJsonSerializer1; this._valueSerializer = paramJsonSerializer2; this._dynamicValueSerializers = PropertySerializerMap.emptyMap(); }
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap paramPropertySerializerMap, Class<?> paramClass, SerializerProvider paramSerializerProvider) throws JsonMappingException { PropertySerializerMap.SerializerAndMapResult localSerializerAndMapResult = paramPropertySerializerMap.findAndAddSerializer(paramClass, paramSerializerProvider, this._property); if (paramPropertySerializerMap != localSerializerAndMapResult.map) this._dynamicValueSerializers = localSerializerAndMapResult.map; return localSerializerAndMapResult.serializer; }
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap paramPropertySerializerMap, JavaType paramJavaType, SerializerProvider paramSerializerProvider) throws JsonMappingException { PropertySerializerMap.SerializerAndMapResult localSerializerAndMapResult = paramPropertySerializerMap.findAndAddSerializer(paramJavaType, paramSerializerProvider, this._property); if (paramPropertySerializerMap != localSerializerAndMapResult.map) this._dynamicValueSerializers = localSerializerAndMapResult.map; return localSerializerAndMapResult.serializer; }
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap paramPropertySerializerMap, Class<?> paramClass, SerializerProvider paramSerializerProvider) throws JsonMappingException { if (this._nonTrivialBaseType != null); for (PropertySerializerMap.SerializerAndMapResult localSerializerAndMapResult = paramPropertySerializerMap.findAndAddSerializer(this._nonTrivialBaseType.forcedNarrowBy(paramClass), paramSerializerProvider, this); ; localSerializerAndMapResult = paramPropertySerializerMap.findAndAddSerializer(paramClass, paramSerializerProvider, this)) { if (paramPropertySerializerMap != localSerializerAndMapResult.map) this._dynamicSerializers = localSerializerAndMapResult.map; return localSerializerAndMapResult.serializer; } }
public void serializeAsField(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider) throws Exception { Object localObject = get(paramObject); if (localObject == null) if (!this._suppressNulls) { paramJsonGenerator.writeFieldName(this._name); paramSerializerProvider.defaultSerializeNull(paramJsonGenerator); } do { return; if (localObject != paramObject) continue; _reportSelfReference(paramObject); } while ((this._suppressableValue != null) && (this._suppressableValue.equals(localObject))); JsonSerializer localJsonSerializer = this._serializer; if (localJsonSerializer == null) { Class localClass = localObject.getClass(); PropertySerializerMap localPropertySerializerMap = this._dynamicSerializers; localJsonSerializer = localPropertySerializerMap.serializerFor(localClass); if (localJsonSerializer == null) localJsonSerializer = _findAndAddDynamic(localPropertySerializerMap, localClass, paramSerializerProvider); } paramJsonGenerator.writeFieldName(this._name); if (this._typeSerializer == null) { localJsonSerializer.serialize(localObject, paramJsonGenerator, paramSerializerProvider); return; } localJsonSerializer.serializeWithType(localObject, paramJsonGenerator, paramSerializerProvider, this._typeSerializer); }
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap paramPropertySerializerMap, Class<?> paramClass, SerializerProvider paramSerializerProvider) { PropertySerializerMap.SerializerAndMapResult localSerializerAndMapResult = paramPropertySerializerMap.findAndAddSerializer(paramClass, paramSerializerProvider, this._property); if (paramPropertySerializerMap != localSerializerAndMapResult.map) this._dynamicValueSerializers = localSerializerAndMapResult.map; return localSerializerAndMapResult.serializer; }
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap paramPropertySerializerMap, JavaType paramJavaType, SerializerProvider paramSerializerProvider) { PropertySerializerMap.SerializerAndMapResult localSerializerAndMapResult = paramPropertySerializerMap.findAndAddSerializer(paramJavaType, paramSerializerProvider, this._property); if (paramPropertySerializerMap != localSerializerAndMapResult.map) this._dynamicValueSerializers = localSerializerAndMapResult.map; return localSerializerAndMapResult.serializer; }
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap paramPropertySerializerMap, Class<?> paramClass, SerializerProvider paramSerializerProvider) { PropertySerializerMap.SerializerAndMapResult localSerializerAndMapResult = paramPropertySerializerMap.findAndAddSerializer(paramClass, paramSerializerProvider, this._property); if (paramPropertySerializerMap != localSerializerAndMapResult.map) this._dynamicSerializers = localSerializerAndMapResult.map; return localSerializerAndMapResult.serializer; }
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap paramPropertySerializerMap, JavaType paramJavaType, SerializerProvider paramSerializerProvider) { PropertySerializerMap.SerializerAndMapResult localSerializerAndMapResult = paramPropertySerializerMap.findAndAddSerializer(paramJavaType, paramSerializerProvider, this._property); if (paramPropertySerializerMap != localSerializerAndMapResult.map) this._dynamicSerializers = localSerializerAndMapResult.map; return localSerializerAndMapResult.serializer; }
protected JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap paramPropertySerializerMap, Class<?> paramClass, SerializerProvider paramSerializerProvider) { if (this._nonTrivialBaseType != null); for (PropertySerializerMap.SerializerAndMapResult localSerializerAndMapResult = paramPropertySerializerMap.findAndAddSerializer(paramSerializerProvider.constructSpecializedType(this._nonTrivialBaseType, paramClass), paramSerializerProvider, this); ; localSerializerAndMapResult = paramPropertySerializerMap.findAndAddSerializer(paramClass, paramSerializerProvider, this)) { if (paramPropertySerializerMap != localSerializerAndMapResult.map) this._dynamicSerializers = localSerializerAndMapResult.map; return localSerializerAndMapResult.serializer; } }
public void serializeAsField(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider) { Object localObject = get(paramObject); if (localObject == null) if (!this._suppressNulls) { paramJsonGenerator.writeFieldName(this._name); paramSerializerProvider.defaultSerializeNull(paramJsonGenerator); } do { return; if (localObject == paramObject) _reportSelfReference(paramObject); } while ((this._suppressableValue != null) && (this._suppressableValue.equals(localObject))); JsonSerializer localJsonSerializer = this._serializer; if (localJsonSerializer == null) { Class localClass = localObject.getClass(); PropertySerializerMap localPropertySerializerMap = this._dynamicSerializers; localJsonSerializer = localPropertySerializerMap.serializerFor(localClass); if (localJsonSerializer == null) localJsonSerializer = _findAndAddDynamic(localPropertySerializerMap, localClass, paramSerializerProvider); } paramJsonGenerator.writeFieldName(this._name); if (this._typeSerializer == null) { localJsonSerializer.serialize(localObject, paramJsonGenerator, paramSerializerProvider); return; } localJsonSerializer.serializeWithType(localObject, paramJsonGenerator, paramSerializerProvider, this._typeSerializer); }
/** * Method called to serialize fields, when the value type is not statically known. */ public void serializeFields(Map<?,?> value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException { // If value type needs polymorphic type handling, some more work needed: if (_valueTypeSerializer != null) { serializeTypedFields(value, jgen, provider); return; } final JsonSerializer<Object> keySerializer = _keySerializer; final HashSet<String> ignored = _ignoredEntries; final boolean skipNulls = !provider.isEnabled(SerializationConfig.Feature.WRITE_NULL_MAP_VALUES); PropertySerializerMap serializers = _dynamicValueSerializers; for (Map.Entry<?,?> entry : value.entrySet()) { Object valueElem = entry.getValue(); // First, serialize key Object keyElem = entry.getKey(); if (keyElem == null) { provider.getNullKeySerializer().serialize(null, jgen, provider); } else { // [JACKSON-314] skip entries with null values? if (skipNulls && valueElem == null) continue; // One twist: is entry ignorable? If so, skip if (ignored != null && ignored.contains(keyElem)) continue; keySerializer.serialize(keyElem, jgen, provider); } // And then value if (valueElem == null) { provider.defaultSerializeNull(jgen); } else { Class<?> cc = valueElem.getClass(); JsonSerializer<Object> serializer = serializers.serializerFor(cc); if (serializer == null) { if (_valueType.hasGenericTypes()) { serializer = _findAndAddDynamic(serializers, provider.constructSpecializedType(_valueType, cc), provider); } else { serializer = _findAndAddDynamic(serializers, cc, provider); } serializers = _dynamicValueSerializers; } try { serializer.serialize(valueElem, jgen, provider); } catch (Exception e) { // [JACKSON-55] Need to add reference information String keyDesc = ""+keyElem; wrapAndThrow(provider, e, value, keyDesc); } } } }
public void serializeTypedContents(Object[] paramArrayOfObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider) { int i = paramArrayOfObject.length; TypeSerializer localTypeSerializer = this._valueTypeSerializer; int j = 0; Object localObject = null; while (true) { try { PropertySerializerMap localPropertySerializerMap = this._dynamicSerializers; if (j < i) { localObject = paramArrayOfObject[j]; if (localObject == null) { paramSerializerProvider.defaultSerializeNull(paramJsonGenerator); } else { Class localClass = localObject.getClass(); JsonSerializer localJsonSerializer = localPropertySerializerMap.serializerFor(localClass); if (localJsonSerializer == null) localJsonSerializer = _findAndAddDynamic(localPropertySerializerMap, localClass, paramSerializerProvider); localJsonSerializer.serializeWithType(localObject, paramJsonGenerator, paramSerializerProvider, localTypeSerializer); } } } catch (IOException localIOException) { throw localIOException; Throwable localThrowable; if (((localThrowable instanceof InvocationTargetException)) && (localThrowable.getCause() != null)) { localThrowable = localThrowable.getCause(); continue; } if ((localThrowable instanceof Error)) throw ((Error)localThrowable); throw JsonMappingException.wrapWithPath(localThrowable, localObject, j); return; } catch (Exception localException) { continue; } j++; } }