/** * Method for constructing a {@link CollectionLikeType}. *<p> * NOTE: type modifiers are NOT called on constructed type itself; but are called * for contained types. */ public CollectionLikeType constructCollectionLikeType(Class<?> collectionClass, Class<?> elementClass) { return constructCollectionLikeType(collectionClass, _fromClass(null, elementClass, EMPTY_BINDINGS)); }
/** * Method that can be used to construct "raw" Collection-like type; meaning that its * parameterization is unknown. * This is similar to using <code>Object.class</code> parameterization, * and is equivalent to calling: *<pre> * typeFactory.constructCollectionLikeType(collectionClass, typeFactory.unknownType()); *</pre> *<p> * This method should only be used if parameterization is completely unavailable. */ public CollectionLikeType constructRawCollectionLikeType(Class<?> collectionClass) { return constructCollectionLikeType(collectionClass, unknownType()); }
public HalResourcesDeserializer() { this(TypeFactory.defaultInstance().constructCollectionLikeType(List.class, Object.class), null); }
HalFormsResourcesDeserializer() { this(TypeFactory.defaultInstance().constructCollectionLikeType(List.class, Object.class)); }
public HalLinkListDeserializer() { super(TypeFactory.defaultInstance().constructCollectionLikeType(List.class, Link.class)); }
public HalResourcesDeserializer(JavaType vc) { this(TypeFactory.defaultInstance().constructCollectionLikeType(List.class, vc), vc); }
CollectionJsonLinkListDeserializer() { super(TypeFactory.defaultInstance().constructCollectionLikeType(List.class, Link.class)); }
public MediaTypesDeserializer() { super(TypeFactory.defaultInstance().constructCollectionLikeType(List.class, MediaType.class)); }
private static JsonDeserializer<?> wrapIfCollection(PersistentProperty<?> property, JsonDeserializer<Object> elementDeserializer, DeserializationConfig config) { if (!property.isCollectionLike()) { return elementDeserializer; } CollectionLikeType collectionType = config.getTypeFactory().constructCollectionLikeType(property.getType(), property.getActualType()); CollectionValueInstantiator instantiator = new CollectionValueInstantiator(property); return new CollectionDeserializer(collectionType, elementDeserializer, null, instantiator); } }
@Override public JavaType toJavaType(Headers headers) { String typeIdHeader = retrieveHeaderAsString(headers, getClassIdFieldName()); if (typeIdHeader != null) { JavaType classType = getClassIdType(typeIdHeader); if (!classType.isContainerType() || classType.isArrayType()) { return classType; } JavaType contentClassType = getClassIdType(retrieveHeader(headers, getContentClassIdFieldName())); if (classType.getKeyType() == null) { return TypeFactory.defaultInstance() .constructCollectionLikeType(classType.getRawClass(), contentClassType); } JavaType keyClassType = getClassIdType(retrieveHeader(headers, getKeyClassIdFieldName())); return TypeFactory.defaultInstance() .constructMapLikeType(classType.getRawClass(), keyClassType, contentClassType); } return null; }
public HalLinkListDeserializer() { super(TypeFactory.defaultInstance().constructCollectionLikeType(List.class, Link.class)); }
public HalResourcesDeserializer() { this(TypeFactory.defaultInstance().constructCollectionLikeType(List.class, Object.class), null); }
/** * Method for constructing a {@link CollectionLikeType}. *<p> * NOTE: type modifiers are NOT called on constructed type itself; but are called * for contained types. */ public CollectionLikeType constructCollectionLikeType(Class<?> collectionClass, Class<?> elementClass) { return constructCollectionLikeType(collectionClass, _fromClass(null, elementClass, EMPTY_BINDINGS)); }
/** * Method for constructing a {@link CollectionLikeType}. *<p> * NOTE: type modifiers are NOT called on constructed type itself; but are called * for contained types. */ public CollectionLikeType constructCollectionLikeType(Class<?> collectionClass, Class<?> elementClass) { return constructCollectionLikeType(collectionClass, _fromClass(null, elementClass, EMPTY_BINDINGS)); }
/** * Method that can be used to construct "raw" Collection-like type; meaning that its * parameterization is unknown. * This is similar to using <code>Object.class</code> parameterization, * and is equivalent to calling: *<pre> * typeFactory.constructCollectionLikeType(collectionClass, typeFactory.unknownType()); *</pre> *<p> * This method should only be used if parameterization is completely unavailable. */ public CollectionLikeType constructRawCollectionLikeType(Class<?> collectionClass) { return constructCollectionLikeType(collectionClass, unknownType()); }
/** * @since 2.5 * @param json the json to unmarshall * @param javaTypeContainer the collection * @param javaType the pojo to use for unmarshalling * @return the collection of pojos generated from the json */ public <T> T readJSON(String json, Class javaTypeContainer, Class javaType) { try { JavaType type = mapper.getTypeFactory().constructCollectionLikeType(javaTypeContainer, javaType); return mapper.readValue(json, type); } catch (IOException reason) { throw new NuxeoClientException("Converter Read Issue.", reason); } }
SetCodec(Codec<E> elementCodec) { super( typeFactory.constructCollectionLikeType(Set.class, elementCodec.getJavaType()), new RawSet(elementCodec.getCqlType()), elementCodec); }
ListCodec(Codec<E> elementCodec) { super( typeFactory.constructCollectionLikeType(List.class, elementCodec.getJavaType()), new RawList(elementCodec.getCqlType()), elementCodec); }
private static JsonDeserializer<?> wrapIfCollection(PersistentProperty<?> property, JsonDeserializer<Object> elementDeserializer, DeserializationConfig config) { if (!property.isCollectionLike()) { return elementDeserializer; } CollectionLikeType collectionType = config.getTypeFactory().constructCollectionLikeType(property.getType(), property.getActualType()); CollectionValueInstantiator instantiator = new CollectionValueInstantiator(property); return new CollectionDeserializer(collectionType, elementDeserializer, null, instantiator); } }
private JavaType fromTypeHeader(MessageProperties properties, String typeIdHeader) { JavaType classType = getClassIdType(typeIdHeader); if (!classType.isContainerType() || classType.isArrayType()) { return classType; } JavaType contentClassType = getClassIdType(retrieveHeader(properties, getContentClassIdFieldName())); if (classType.getKeyType() == null) { return TypeFactory.defaultInstance() .constructCollectionLikeType(classType.getRawClass(), contentClassType); } JavaType keyClassType = getClassIdType(retrieveHeader(properties, getKeyClassIdFieldName())); return TypeFactory.defaultInstance() .constructMapLikeType(classType.getRawClass(), keyClassType, contentClassType); }