summaryrefslogtreecommitdiffstats
path: root/sangria-core/src/main
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-05-06 20:39:47 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-05-06 20:39:47 -0400
commit39684339724ce966332deb846061d12701db99f2 (patch)
tree99a52d217d2c3d09a53c993840d01a4d2161d874 /sangria-core/src/main
parent4045e8eb8ca8c8dc534b7f0fd69953a839ca801a (diff)
downloadsangria-39684339724ce966332deb846061d12701db99f2.tar.xz
core: Make TypeLiterals use JSR-330 Providers.
Diffstat (limited to 'sangria-core/src/main')
-rw-r--r--sangria-core/src/main/java/com/tavianator/sangria/core/TypeLiterals.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/sangria-core/src/main/java/com/tavianator/sangria/core/TypeLiterals.java b/sangria-core/src/main/java/com/tavianator/sangria/core/TypeLiterals.java
index 833f70d..ff42790 100644
--- a/sangria-core/src/main/java/com/tavianator/sangria/core/TypeLiterals.java
+++ b/sangria-core/src/main/java/com/tavianator/sangria/core/TypeLiterals.java
@@ -19,7 +19,8 @@ package com.tavianator.sangria.core;
import java.util.*;
-import com.google.inject.Provider;
+import javax.inject.Provider;
+
import com.google.inject.TypeLiteral;
import com.google.inject.util.Types;
@@ -77,11 +78,13 @@ public class TypeLiterals {
@SuppressWarnings("unchecked")
public static <T> TypeLiteral<Provider<T>> providerOf(Class<T> type) {
- return (TypeLiteral<Provider<T>>)TypeLiteral.get(Types.providerOf(type));
+ // Can't use Types.providerOf() because we want to stick to JSR-330 Providers
+ return (TypeLiteral<Provider<T>>)TypeLiteral.get(Types.newParameterizedType(Provider.class, type));
}
@SuppressWarnings("unchecked")
public static <T> TypeLiteral<Provider<T>> providerOf(TypeLiteral<T> type) {
- return (TypeLiteral<Provider<T>>)TypeLiteral.get(Types.providerOf(type.getType()));
+ // Can't use Types.providerOf() because we want to stick to JSR-330 Providers
+ return (TypeLiteral<Provider<T>>)TypeLiteral.get(Types.newParameterizedType(Provider.class, type.getType()));
}
}