1 package org.neo4j.driver.projection;
2
3 import org.neo4j.driver.exception.Neo4jClientException;
4 import org.neo4j.driver.v1.Record;
5
6 import java.util.function.Function;
7
8
9
10
11
12 abstract class Projection<T> implements Function<Record, T> {
13
14
15
16
17 protected Class type;
18
19
20
21
22
23
24 public Projection(Class type) {
25 this.type = type;
26 }
27
28
29
30
31
32
33
34 protected void checkIfRecordHaveSingleValue(Record record) {
35 if (record.size() > 1) {
36 throw new Neo4jClientException("Record doesn't have a single column -> can't cast it to primitive object type");
37 }
38 }
39
40 }