Class<?> collectionClass = type.getRawClass(); BasicBeanDescription beanDesc = config.introspectForCreation(type); JavaType contentType = type.getContentType(); if (type.isInterface() || type.isAbstract()) { @SuppressWarnings({ "rawtypes" }) Class<? extends Collection> fallback = _collectionFallbacks.get(collectionClass.getName());
@Override protected JavaType _narrow(Class<?> subclass) { return new CollectionType(subclass, _elementType, null, null); }
/** * Method for constructing a {@link CollectionType}. *<p> * NOTE: type modifiers are NOT called on Collection type itself; but are called * for contained types. */ public CollectionType constructCollectionType(Class<? extends Collection> collectionClass, JavaType elementType) { return CollectionType.construct(collectionClass, elementType); }
Class<?> raw = type.getRawClass(); if (EnumSet.class.isAssignableFrom(raw)) { return buildEnumSetSerializer(config, type, beanDesc, property, staticTyping, elementTypeSerializer, elementValueSerializer); Class<?> elementRaw = type.getContentType().getRawClass(); if (isIndexedList(raw)) { if (elementRaw == String.class) { return new IndexedStringListSerializer(property, elementValueSerializer); return StdContainerSerializers.indexedListSerializer(type.getContentType(), staticTyping, elementTypeSerializer, property, elementValueSerializer); return new StringCollectionSerializer(property, elementValueSerializer); return StdContainerSerializers.collectionSerializer(type.getContentType(), staticTyping, elementTypeSerializer, property, elementValueSerializer);
return CollectionType.construct(clz, (parentType == null) ? _unknownType() : parentType.getContentType());
@Override public JsonDeserializer<?> findCollectionDeserializer(CollectionType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException { return (_classMappings == null) ? null : _classMappings.get(new ClassKey(type.getRawClass())); }
Class<?> enumClass = ClassUtil.findEnumType((EnumSet<?>) value); str = TypeFactory.defaultInstance().constructCollectionType(EnumSet.class, enumClass).toCanonical(); } else if (value instanceof EnumMap<?,?>) { Class<?> enumClass = ClassUtil.findEnumType((EnumMap<?,?>) value);
@Override public JavaType widenContentsBy(Class<?> contentClass) { // Can do a quick check first: if (contentClass == _elementType.getRawClass()) { return this; } return new CollectionType(_class, _elementType.widenBy(contentClass)).copyHandlers(this); }
public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { ObjectNode o = createSchemaNode("array", true); if (typeHint != null) { JavaType javaType = TypeFactory.type(typeHint); if (javaType instanceof CollectionType) { Class<?> componentType = ((CollectionType) javaType).getContentType().getRawClass(); JsonSerializer<Object> ser = provider.findValueSerializer(componentType); JsonNode schemaNode = (ser instanceof SchemaAware) ? ((SchemaAware) ser).getSchema(provider, null) : JsonSchema.getDefaultSchemaNode(); o.put("items", schemaNode); } } return o; } }
Class<?> raw = type.getRawClass(); if (EnumSet.class.isAssignableFrom(raw)) { return buildEnumSetSerializer(config, type, beanDesc, property, staticTyping, elementTypeSerializer, elementValueSerializer); Class<?> elementRaw = type.getContentType().getRawClass(); if (isIndexedList(raw)) { if (elementRaw == String.class) { return new IndexedStringListSerializer(property, elementValueSerializer); return StdContainerSerializers.indexedListSerializer(type.getContentType(), staticTyping, elementTypeSerializer, property, elementValueSerializer); return new StringCollectionSerializer(property, elementValueSerializer); return StdContainerSerializers.collectionSerializer(type.getContentType(), staticTyping, elementTypeSerializer, property, elementValueSerializer);
@Override public JsonDeserializer<?> findCollectionDeserializer(CollectionType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException { return (_classMappings == null) ? null : _classMappings.get(new ClassKey(type.getRawClass())); }
Class<?> enumClass = ClassUtil.findEnumType((EnumSet<?>) value); str = TypeFactory.defaultInstance().constructCollectionType(EnumSet.class, enumClass).toCanonical(); } else if (value instanceof EnumMap<?,?>) { Class<?> enumClass = ClassUtil.findEnumType((EnumMap<?,?>) value);
@Override public JavaType narrowContentsBy(Class<?> contentClass) { // Can do a quick check first: if (contentClass == _elementType.getRawClass()) { return this; } return new CollectionType(_class, _elementType.narrowBy(contentClass)).copyHandlers(this); }
public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { ObjectNode o = createSchemaNode("array", true); if (typeHint != null) { JavaType javaType = TypeFactory.type(typeHint); if (javaType instanceof CollectionType) { Class<?> componentType = ((CollectionType) javaType).getContentType().getRawClass(); JsonSerializer<Object> ser = provider.findValueSerializer(componentType); JsonNode schemaNode = (ser instanceof SchemaAware) ? ((SchemaAware) ser).getSchema(provider, null) : JsonSchema.getDefaultSchemaNode(); o.put("items", schemaNode); } } return o; } }
Class<?> collectionClass = type.getRawClass(); BasicBeanDescription beanDesc = config.introspectForCreation(type); JavaType contentType = type.getContentType(); if (type.isInterface() || type.isAbstract()) { @SuppressWarnings({ "rawtypes" }) Class<? extends Collection> fallback = _collectionFallbacks.get(collectionClass.getName());
public static CollectionType construct(Class<?> rawType, JavaType elemT) { // nominally component types will be just Object.class return new CollectionType(rawType, elemT, null, null); }
@Override public JsonDeserializer<?> findCollectionDeserializer(CollectionType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException { if (type.getRawClass() == Array.class) { return new JSArrayDeserializer(type, provider.findValueDeserializer(config, type.getContentType(), property), elementTypeDeserializer); } return super.findCollectionDeserializer(type, config, provider, beanDesc, property, elementTypeDeserializer, elementDeserializer); }
/** * Method for constructing a {@link CollectionType}. *<p> * NOTE: type modifiers are NOT called on Collection type itself; but are called * for contained types. */ public CollectionType constructCollectionType(Class<? extends Collection> collectionClass, Class<?> elementClass) { return CollectionType.construct(collectionClass, constructType(elementClass)); }
@Override public JsonDeserializer<?> findCollectionDeserializer(CollectionType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException { return (_classMappings == null) ? null : _classMappings.get(new ClassKey(type.getRawClass())); }
Class<?> enumClass = ClassUtil.findEnumType((EnumSet<?>) value); str = TypeFactory.defaultInstance().constructCollectionType(EnumSet.class, enumClass).toCanonical(); } else if (value instanceof EnumMap<?,?>) { Class<?> enumClass = ClassUtil.findEnumType((EnumMap<?,?>) value);