View Javadoc
1   package org.neo4j.driver.projection;
2   
3   import org.neo4j.driver.v1.Record;
4   
5   import java.lang.reflect.Type;
6   import java.util.ArrayList;
7   import java.util.List;
8   
9   /**
10   * Projection for list type on single column result.
11   */
12  public class ProjectionListSingle extends Projection<List> {
13  
14      /**
15       * Type of list's object.
16       */
17      protected Type listType;
18  
19      /**
20       * Default constructor.
21       */
22      public ProjectionListSingle(Type type) {
23          super(ArrayList.class);
24          listType = type;
25      }
26  
27      @Override public List apply(Record record) {
28          checkIfRecordHaveSingleValue(record);
29          return (List) ConversionHelper.convertDriverValueTo(listType, record.get(0));
30      }
31  
32  }