Java Code Examples for com.fasterxml.jackson.databind.type.CollectionType#construct()

The following examples show how to use com.fasterxml.jackson.databind.type.CollectionType#construct() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapDeserializerManager.java    From caravan with Apache License 2.0 6 votes vote down vote up
public MapDeserializerManager(MapCustomizationFactory factory) {
  /**
   * The first parameter is just a placeholder, won't be used.
   * So any element type is ok.
   */
  super(
      CollectionType.construct(ArrayList.class, null, null, null, //
          SimpleType.constructUnsafe(Object.class)), //
      null, null, new ValueInstantiator() {
        @SuppressWarnings("rawtypes")
        @Override
        public Object createUsingDefault(DeserializationContext ctxt) throws IOException {
          return new ArrayList();
        }
      });

  this.factory = factory;
}
 
Example 2
Source File: MapDeserializer.java    From caravan with Apache License 2.0 5 votes vote down vote up
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();
        }
      });
}
 
Example 3
Source File: MapDeserializer.java    From caravan with Apache License 2.0 4 votes vote down vote up
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);
}
 
Example 4
Source File: Integration1.java    From eagle with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example 5
Source File: ExtendedDeduplicatorTest.java    From eagle with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example 6
Source File: TestAlertPublisherBolt.java    From eagle with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example 7
Source File: SchedulerTest.java    From eagle with Apache License 2.0 4 votes vote down vote up
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;
}