@Override public final TypeFactory getTypeFactory() { return _config.getTypeFactory(); }
public TypeFactory getTypeFactory() { return _config.getTypeFactory(); }
/** * Method that will construct a new instance that uses specific type * as the root type for serialization, instead of runtime dynamic * type of the root object itself. * * @since 2.5 */ public ObjectWriter forType(TypeReference<?> rootType) { return forType(_config.getTypeFactory().constructType(rootType.getType())); }
@Override public TypeSerializer buildTypeSerializer(SerializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { if (_idType != JsonTypeInfo.Id.CUSTOM || _includeAs != JsonTypeInfo.As.WRAPPER_OBJECT) { return super.buildTypeSerializer(config, baseType, subtypes); } TypeIdResolver idRes = new ValueReferenceTypeIdResolver(baseType, config.getTypeFactory(), subtypes); return new AsPropertyTypeSerializer(idRes, null, this._typeProperty); } }
/** * Reflection-based serialized find method, which checks if * given class implements one of recognized "add-on" interfaces. * Add-on here means a role that is usually or can be a secondary * trait: for example, * bean classes may implement {@link Iterable}, but their main * function is usually something else. The reason for */ protected final JsonSerializer<?> findSerializerByAddonType(SerializationConfig config, JavaType javaType, BeanDescription beanDesc, boolean staticTyping) throws JsonMappingException { Class<?> rawType = javaType.getRawClass(); if (Iterator.class.isAssignableFrom(rawType)) { JavaType[] params = config.getTypeFactory().findTypeParameters(javaType, Iterator.class); JavaType vt = (params == null || params.length != 1) ? TypeFactory.unknownType() : params[0]; return buildIteratorSerializer(config, javaType, beanDesc, staticTyping, vt); } if (Iterable.class.isAssignableFrom(rawType)) { JavaType[] params = config.getTypeFactory().findTypeParameters(javaType, Iterable.class); JavaType vt = (params == null || params.length != 1) ? TypeFactory.unknownType() : params[0]; return buildIterableSerializer(config, javaType, beanDesc, staticTyping, vt); } if (CharSequence.class.isAssignableFrom(rawType)) { return ToStringSerializer.instance; } return null; }
TypeFactory typeFactory = provider.getConfig().getTypeFactory(); JavaType keyType = typeFactory.constructType(String.class); JavaType valueType = typeFactory.constructCollectionType(ArrayList.class, Object.class);
@Override public final TypeFactory getTypeFactory() { return _config.getTypeFactory(); }
@Override public final TypeFactory getTypeFactory() { return _config.getTypeFactory(); }
@Override public final TypeFactory getTypeFactory() { return _config.getTypeFactory(); }
@Override public final TypeFactory getTypeFactory() { return _config.getTypeFactory(); }
/** * Convenience method for constructing {@link JavaType} for given JDK * type (usually {@link java.lang.Class}) */ public JavaType constructType(Type type) { return _config.getTypeFactory().constructType(type); }
/** * Convenience method for constructing {@link JavaType} for given JDK * type (usually {@link java.lang.Class}) */ public JavaType constructType(Type type) { return _config.getTypeFactory().constructType(type); }
/** * Method that will construct a new instance that uses specific type * as the root type for serialization, instead of runtime dynamic * type of the root object itself. * * @since 2.5 */ public ObjectWriter forType(TypeReference<?> rootType) { return forType(_config.getTypeFactory().constructType(rootType.getType())); }
/** * Method that will construct a new instance that uses specific type * as the root type for serialization, instead of runtime dynamic * type of the root object itself. * * @since 2.5 */ public ObjectWriter forType(TypeReference<?> rootType) { return forType(_config.getTypeFactory().constructType(rootType.getType())); }
public ObjectWriter forType(TypeReference<?> rootType) { return forType(_config.getTypeFactory().constructType(rootType.getType())); }
@Deprecated // since 2.5 protected JsonSerializer<?> buildIteratorSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc, boolean staticTyping) throws JsonMappingException { JavaType[] params = config.getTypeFactory().findTypeParameters(type, Iterator.class); JavaType vt = (params == null || params.length != 1) ? TypeFactory.unknownType() : params[0]; return buildIteratorSerializer(config, type, beanDesc, staticTyping, vt); }
@Deprecated // since 2.5 protected JsonSerializer<?> buildIteratorSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc, boolean staticTyping) throws JsonMappingException { JavaType[] params = config.getTypeFactory().findTypeParameters(type, Iterator.class); JavaType vt = (params == null || params.length != 1) ? TypeFactory.unknownType() : params[0]; return buildIteratorSerializer(config, type, beanDesc, staticTyping, vt); }
@Override public JsonSerializer<?> modifyCollectionSerializer(SerializationConfig config, CollectionType valueType, BeanDescription beanDesc, JsonSerializer<?> serializer) { if (valueType.getRawClass() == ArrayList.class) { return new IiifIndexedListSerializer((IndexedListSerializer) serializer, config.getTypeFactory()); } return super.modifyCollectionSerializer(config, valueType, beanDesc, serializer); }
@Deprecated // since 2.5 protected JsonSerializer<?> buildIterableSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc, boolean staticTyping) throws JsonMappingException { JavaType[] params = config.getTypeFactory().findTypeParameters(type, Iterable.class); JavaType vt = (params == null || params.length != 1) ? TypeFactory.unknownType() : params[0]; return buildIterableSerializer(config, type, beanDesc, staticTyping, vt); }
@Deprecated // since 2.5 protected JsonSerializer<?> buildIterableSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc, boolean staticTyping) throws JsonMappingException { JavaType[] params = config.getTypeFactory().findTypeParameters(type, Iterable.class); JavaType vt = (params == null || params.length != 1) ? TypeFactory.unknownType() : params[0]; return buildIterableSerializer(config, type, beanDesc, staticTyping, vt); }