View Javadoc
1   package org.neo4j.driver.projection;
2   
3   import org.neo4j.driver.v1.Record;
4   
5   /**
6    * Projection for Pojo.
7    */
8   public class ProjectionClass<T> extends Projection<T> {
9   
10      /**
11       * Default constructor.
12       */
13      public ProjectionClass(Class type) {
14          super(type);
15      }
16  
17      @Override public T apply(Record record) {
18          DynamicClassConstructor<T> generator = new DynamicClassConstructor(type);
19          T result = generator.construct();
20          for (String key : record.keys()) {
21              generator.add(result, key, record.get(key));
22          }
23          return result;
24      }
25  
26  }