1 package org.neo4j.driver.projection;
2
3 /**
4 * Factory that generate {@link Projection}.
5 */
6 public class Projections {
7
8 /**
9 * Create a <code>type</code> projection for a query result with only one column.
10 */
11 public static <T> Projection<T> singleAs(Class<T> type) {
12 return new ProjectionClassSingle<T>(type);
13 }
14
15 /**
16 * Create a <code>type</code> projection for a query result with only one column that is a list.
17 * This was created because a list of class is not a class.
18 * SO to call this method you have to pass the parameter like this <code>new ArrayList<Movie>(){}.getClass()</code>.
19 */
20 public static ProjectionListSingle singleAsListOf(Class type) {
21 return new ProjectionListSingle(type.getGenericSuperclass());
22 }
23
24 /**
25 * Create a simple <code>type</code> projection.
26 */
27 public static <T> Projection<T> as(Class<T> type) {
28 return new ProjectionClass<T>(type);
29 }
30
31 }