private JavaType _collectionType(Class<?> rawClass, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces) { List<JavaType> typeParams = bindings.getTypeParameters(); // ok to have no types ("raw") JavaType ct; if (typeParams.isEmpty()) { ct = _unknownType(); } else if (typeParams.size() == 1) { ct = typeParams.get(0); } else { throw new IllegalArgumentException("Strange Collection type "+rawClass.getName()+": cannot determine type parameters"); } return CollectionType.construct(rawClass, bindings, superClass, superInterfaces, ct); }
public MapDeserializer(JavaType pairType) { super( CollectionType.construct(ArrayList.class, null, null, null, pairType), // null, null, new ValueInstantiator() { @Override public Object createUsingDefault(DeserializationContext ctxt) throws IOException { return new ArrayList(); } }); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
private JavaType _collectionType(Class<?> rawClass) { JavaType[] typeParams = findTypeParameters(rawClass, Collection.class); // ok to have no types ("raw") if (typeParams == null) { return CollectionType.construct(rawClass, _unknownType()); } // but exactly 2 types if any found if (typeParams.length != 1) { throw new IllegalArgumentException("Strange Collection type "+rawClass.getName()+": can not determine type parameters"); } return CollectionType.construct(rawClass, typeParams[0]); }
private JavaType _collectionType(Class<?> rawClass) { JavaType[] typeParams = findTypeParameters(rawClass, Collection.class); // ok to have no types ("raw") if (typeParams == null) { return CollectionType.construct(rawClass, _unknownType()); } // but exactly 2 types if any found if (typeParams.length != 1) { throw new IllegalArgumentException("Strange Collection type "+rawClass.getName()+": can not determine type parameters"); } return CollectionType.construct(rawClass, typeParams[0]); }
protected MapDeserializer withResolved(JavaType pairType, JsonDeserializer<?> dd, JsonDeserializer<?> vd, TypeDeserializer vtd, NullValueProvider nuller, Boolean unwrapSingle) { CollectionType containerType = CollectionType.construct(ArrayList.class, null, null, null, pairType); return new MapDeserializer(containerType, vd, vtd, this._valueInstantiator, dd, nuller, unwrapSingle); }
/** * Method that can be used to construct "raw" Collection type; meaning that its * parameterization is unknown. * This is similar to using <code>Object.class</code> parameterization, * and is equivalent to calling: *<pre> * typeFactory.constructCollectionType(collectionClass, typeFactory.unknownType()); *<pre> *<p> * This method should only be used if parameterization is completely unavailable. */ public CollectionType constructRawCollectionType(Class<? extends Collection> collectionClass) { return CollectionType.construct(collectionClass, unknownType()); }
private JavaType _collectionType(Class<?> rawClass) { JavaType[] typeParams = findTypeParameters(rawClass, Collection.class); // ok to have no types ("raw") if (typeParams == null) { return CollectionType.construct(rawClass, _unknownType()); } // but exactly 2 types if any found if (typeParams.length != 1) { throw new IllegalArgumentException("Strange Collection type "+rawClass.getName()+": can not determine type parameters"); } return CollectionType.construct(rawClass, typeParams[0]); }
private JavaType _collectionType(Class<?> rawClass) { JavaType[] typeParams = findTypeParameters(rawClass, Collection.class); // ok to have no types ("raw") if (typeParams == null) { return CollectionType.construct(rawClass, _unknownType()); } // but exactly 2 types if any found if (typeParams.length != 1) { throw new IllegalArgumentException("Strange Collection type "+rawClass.getName()+": can not determine type parameters"); } return CollectionType.construct(rawClass, typeParams[0]); }
private <T> List<T> loadEntities(String path, Class<T> tClz) throws Exception { ObjectMapper objectMapper = new ObjectMapper(); JavaType type = CollectionType.construct(List.class, SimpleType.construct(tClz)); List<T> l = objectMapper.readValue(TestAlertPublisherBolt.class.getResourceAsStream(path), type); return l; }
public static <T> List<T> loadEntities(String path, Class<T> tClz) throws Exception { JavaType type = CollectionType.construct(List.class, SimpleType.construct(tClz)); List<T> l = om.readValue(Integration1.class.getResourceAsStream(path), type); return l; }
public static <T> List<T> loadEntities(String path, Class<T> tClz) throws Exception { System.out.println(FileUtils.readFileToString(new File(SchedulerTest.class.getResource(path).getPath()))); JavaType type = CollectionType.construct(List.class, SimpleType.construct(tClz)); List<T> l = mapper.readValue(SchedulerTest.class.getResourceAsStream(path), type); return l; }
private <T> List<T> loadEntities(String path, Class<T> tClz) throws Exception { ObjectMapper objectMapper = new ObjectMapper(); JavaType type = CollectionType.construct(List.class, SimpleType.construct(tClz)); List<T> l = objectMapper.readValue(TestAlertPublisherBolt.class.getResourceAsStream(path), type); return l; }