Home
last modified time | relevance | path

Searched refs:TypeLiteral (Results 1 – 25 of 94) sorted by relevance

1234

/external/guice/core/test/com/google/inject/
DTypeLiteralTest.java38 TypeLiteral<List<String>> a = new TypeLiteral<List<String>>() {}; in testWithParameterizedType()
39 TypeLiteral<List<String>> b = new TypeLiteral<List<String>>( in testWithParameterizedType()
45 TypeLiteral<List<String>> t1 = new TypeLiteral<List<String>>() {}; in testEquality()
46 TypeLiteral<List<String>> t2 = new TypeLiteral<List<String>>() {}; in testEquality()
47 TypeLiteral<List<Integer>> t3 = new TypeLiteral<List<Integer>>() {}; in testEquality()
48 TypeLiteral<String> t4 = new TypeLiteral<String>() {}; in testEquality()
58 TypeLiteral<String> t5 = TypeLiteral.get(String.class); in testEquality()
65 TypeLiteral<?> a = TypeLiteral.get(getClass().getField("wildcardExtends").getGenericType()); in testWithWildcardType()
66 TypeLiteral<?> b = TypeLiteral.get(Types.listOf(Types.subtypeOf(CharSequence.class))); in testWithWildcardType()
67 TypeLiteral<?> c = new TypeLiteral<List<? extends CharSequence>>() {}; in testWithWildcardType()
[all …]
DTypeLiteralInjectionTest.java39 bind(TypeLiteral.class).toInstance(TypeLiteral.get(String.class)); in testBindingToRawTypeLiteralIsNotAllowed()
53 bind(new TypeLiteral<TypeLiteral<String>>() {}) in testBindingToParameterizedTypeLiteralIsNotAllowed()
54 .toInstance(TypeLiteral.get(String.class)); in testBindingToParameterizedTypeLiteralIsNotAllowed()
66 assertEquals(TypeLiteral.get(String.class), c.string); in testInjectTypeLiteralWithRawTypes()
67 assertEquals(TypeLiteral.get(A.class), c.a); in testInjectTypeLiteralWithRawTypes()
73 assertContains(expected.getMessage(), TypeLiteral.class.getName() + "<java.util.List<T>> " in testInjectTypeLiteralWithRawTypes()
80 assertEquals(TypeLiteral.get(String.class), b.string); in testInjectTypeLiteralWithClassTypes()
81 assertEquals(TypeLiteral.get(Integer.class), b.t); in testInjectTypeLiteralWithClassTypes()
82 assertEquals(TypeLiteral.get(listOf(Integer.class)), b.listOfT); in testInjectTypeLiteralWithClassTypes()
83 assertEquals(TypeLiteral.get(listOf(Types.subtypeOf(Integer.class))), b.listOfWildcardT); in testInjectTypeLiteralWithClassTypes()
[all …]
DTypeLiteralTypeResolutionTest.java98 TypeLiteral<?> resolver = TypeLiteral.get(arrayListOfString); in testDirectInheritance()
101 assertEquals(ImmutableList.<TypeLiteral<?>>of(TypeLiteral.get(String.class)), in testDirectInheritance()
106 TypeLiteral<?> resolver = TypeLiteral.get(arrayListOfString); in testGenericSupertype()
117 TypeLiteral<?> resolver = TypeLiteral.get(MyInteger.class); in testRecursiveTypeVariable()
131 TypeLiteral<?> resolver = TypeLiteral.get(hasGenericFieldsOfShort); in testFields()
142 TypeLiteral<?> resolver = TypeLiteral.get(hasGenericConstructorOfShort); in testGenericConstructor()
153 TypeLiteral<?> type = TypeLiteral.get(throwerOfNpe); in testThrowsExceptions()
164 TypeLiteral<?> resolver = TypeLiteral.get(hasArrayOfShort); in testArrays()
175 TypeLiteral<?> resolver = TypeLiteral.get(hasRelatedOfString); in testRelatedTypeVariables()
186 TypeLiteral<?> resolver = TypeLiteral.get( in testCachingAndReindexing()
[all …]
DGenericInjectionTest.java41 bind(new TypeLiteral<List<String>>() {}).toInstance(names); in testGenericInjection()
60 = Guice.createInjector().getInstance(Key.get(new TypeLiteral<Parameterized<String>>() {})); in testImplicitBindingOfGenericType()
67 bind(Key.get(new TypeLiteral<Parameterized<String>>() {})) in testExplicitBindingOfGenericType()
73 = injector.getInstance(Key.get(new TypeLiteral<Parameterized<String>>() { })); in testExplicitBindingOfGenericType()
88 final TypeLiteral<ParameterizedDeps<String, Integer>> type in testInjectingParameterizedDependenciesForBindingTarget()
89 = new TypeLiteral<ParameterizedDeps<String, Integer>>() {}; in testInjectingParameterizedDependenciesForBindingTarget()
99 final TypeLiteral<ParameterizedDeps<String, Integer>> type in testInjectingParameterizedDependenciesForBindingSource()
100 = new TypeLiteral<ParameterizedDeps<String, Integer>>() {}; in testInjectingParameterizedDependenciesForBindingSource()
110 final TypeLiteral<ParameterizedDeps<String, Integer>> type in testBindingToSubtype()
111 = new TypeLiteral<ParameterizedDeps<String, Integer>>() {}; in testBindingToSubtype()
[all …]
DTypeListenerTest.java46 private final Matcher<Object> onlyAbcd = Matchers.only(new TypeLiteral<A>() {})
47 .or(only(new TypeLiteral<B>() {}))
48 .or(only(new TypeLiteral<C>() {}))
49 .or(only(new TypeLiteral<D>() {}));
54 public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
91 public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) { in testTypeListenersAreFired()
92 assertEquals(new TypeLiteral<A>() {}, type); in testTypeListenersAreFired()
118 public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) { in testInstallingInjectionListener()
164 public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
245 public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
[all …]
DKeyTest.java65 Key<List<String>> b = Key.get(new TypeLiteral<List<String>>() {}, Foo.class); in testKeyEquality()
129 TypeLiteral<Integer> intTypeLiteral = TypeLiteral.get(int.class); in testPrimitivesAndWrappersAreEqual()
140 assertNotSerializable(Key.get(new TypeLiteral<Map<List<B>, B>>() {})); in testSerialization()
141 assertNotSerializable(Key.get(new TypeLiteral<List<B[]>>() {})); in testSerialization()
179 TypeLiteral<?> listOfT = TypeLiteral.get(listOfTType); in testCannotCreateKeysWithTypeVariables()
189 TypeLiteral<?> t = TypeLiteral.get(tType); in testCannotCreateKeysWithTypeVariables()
200 TypeLiteral<Integer> typeLiteral = KeyTest.createTypeLiteral(); in testCannotGetKeyWithUnspecifiedTypeVariables()
210 private static <T> TypeLiteral<T> createTypeLiteral() { in createTypeLiteral()
211 return new TypeLiteral<T>() {}; in createTypeLiteral()
294 bind(new TypeLiteral<List<Integer>>() {}).toInstance(new ArrayList<Integer>()); in testAnonymousClassesDontHoldRefs()
[all …]
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/
DFactoryModuleBuilder.java23 import com.google.inject.TypeLiteral;
212 return implement(source, TypeLiteral.get(target)); in implement()
218 public <T> FactoryModuleBuilder implement(Class<T> source, TypeLiteral<? extends T> target) { in implement()
219 return implement(TypeLiteral.get(source), target); in implement()
225 public <T> FactoryModuleBuilder implement(TypeLiteral<T> source, Class<? extends T> target) { in implement()
226 return implement(source, TypeLiteral.get(target)); in implement()
232 public <T> FactoryModuleBuilder implement(TypeLiteral<T> source, in implement()
233 TypeLiteral<? extends T> target) { in implement()
242 return implement(source, annotation, TypeLiteral.get(target)); in implement()
249 TypeLiteral<? extends T> target) { in implement()
[all …]
DFactoryProvider.java31 import com.google.inject.TypeLiteral;
162 private final TypeLiteral<F> factoryType;
163 private final TypeLiteral<?> implementationType;
167 return newFactory(TypeLiteral.get(factoryType), TypeLiteral.get(implementationType)); in newFactory()
171 TypeLiteral<F> factoryType, TypeLiteral<?> implementationType) { in newFactory()
201 private FactoryProvider(TypeLiteral<F> factoryType, in FactoryProvider()
202 TypeLiteral<?> implementationType, in FactoryProvider()
253 TypeLiteral<?> factoryType, TypeLiteral<?> implementationType) { in createMethodMapping()
293 for (TypeLiteral<?> parameterType : factoryType.getParameterTypes(method)) { in createMethodMapping()
/external/guice/core/src/com/google/inject/
DTypeLiteral.java63 public class TypeLiteral<T> { class
78 protected TypeLiteral() { in TypeLiteral() method in TypeLiteral
88 TypeLiteral(Type type) { in TypeLiteral() method in TypeLiteral
110 static TypeLiteral<?> fromSuperclassTypeParameter(Class<?> subclass) { in fromSuperclassTypeParameter()
111 return new TypeLiteral<Object>(getSuperclassTypeParameter(subclass)); in fromSuperclassTypeParameter()
134 final TypeLiteral<Provider<T>> providerType() { in providerType()
137 return (TypeLiteral<Provider<T>>) get(Types.providerOf(getType())); in providerType()
145 return o instanceof TypeLiteral<?> in equals()
146 && MoreTypes.equals(type, ((TypeLiteral) o).type); in equals()
156 public static TypeLiteral<?> get(Type type) { in get()
[all …]
DKey.java59 private final TypeLiteral<T> typeLiteral;
79 (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass())); in Key()
101 (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass())); in Key()
121 (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass())); in Key()
132 this.typeLiteral = MoreTypes.canonicalizeForKey((TypeLiteral<T>) TypeLiteral.get(type)); in Key()
138 private Key(TypeLiteral<T> typeLiteral, AnnotationStrategy annotationStrategy) { in Key()
168 public final TypeLiteral<T> getTypeLiteral() {
286 public static <T> Key<T> get(TypeLiteral<T> typeLiteral) {
293 public static <T> Key<T> get(TypeLiteral<T> typeLiteral,
301 public static <T> Key<T> get(TypeLiteral<T> typeLiteral,
[all …]
/external/guice/core/src/com/google/inject/internal/
DMoreTypes.java27 import com.google.inject.TypeLiteral;
54 private static final Map<TypeLiteral<?>, TypeLiteral<?>> PRIMITIVE_TO_WRAPPER
55 = new ImmutableMap.Builder<TypeLiteral<?>, TypeLiteral<?>>()
56 .put(TypeLiteral.get(boolean.class), TypeLiteral.get(Boolean.class))
57 .put(TypeLiteral.get(byte.class), TypeLiteral.get(Byte.class))
58 .put(TypeLiteral.get(short.class), TypeLiteral.get(Short.class))
59 .put(TypeLiteral.get(int.class), TypeLiteral.get(Integer.class))
60 .put(TypeLiteral.get(long.class), TypeLiteral.get(Long.class))
61 .put(TypeLiteral.get(float.class), TypeLiteral.get(Float.class))
62 .put(TypeLiteral.get(double.class), TypeLiteral.get(Double.class))
[all …]
DTypeConverterBindingProcessor.java19 import com.google.inject.TypeLiteral;
55 public Object convert(String value, TypeLiteral<?> toType) { in prepareBuiltInConverters()
70 public Object convert(String value, TypeLiteral<?> toType) { in prepareBuiltInConverters()
79 internalConvertToTypes(injector, new AbstractMatcher<TypeLiteral<?>>() { in prepareBuiltInConverters()
80 public boolean matches(TypeLiteral<?> typeLiteral) { in prepareBuiltInConverters()
90 public Object convert(String value, TypeLiteral<?> toType) { in prepareBuiltInConverters()
113 public Object convert(String value, TypeLiteral<?> toType) { in convertToPrimitiveType()
141 internalConvertToTypes(injector, new AbstractMatcher<TypeLiteral<?>>() { in convertToClasses()
142 public boolean matches(TypeLiteral<?> typeLiteral) { in convertToClasses()
158 Matcher<? super TypeLiteral<?>> typeMatcher, in internalConvertToTypes()
DMembersInjectorStore.java23 import com.google.inject.TypeLiteral;
41 private final FailableCache<TypeLiteral<?>, MembersInjectorImpl<?>> cache
42 = new FailableCache<TypeLiteral<?>, MembersInjectorImpl<?>>() {
43 @Override protected MembersInjectorImpl<?> create(TypeLiteral<?> type, Errors errors)
67 public <T> MembersInjectorImpl<T> get(TypeLiteral<T> key, Errors errors) throws ErrorsException { in get()
80 boolean remove(TypeLiteral<?> type) { in remove()
87 private <T> MembersInjectorImpl<T> createWithListeners(TypeLiteral<T> type, Errors errors) in createWithListeners()
/external/guice/core/test/com/google/inject/internal/
DMoreTypesTest.java19 import com.google.inject.TypeLiteral;
33 TypeLiteral<Inner<String>> innerString = new TypeLiteral<Inner<String>>(){}; in testParameterizedTypeToString()
37 TypeLiteral<Set<Inner<Integer>>> mapInnerInteger = new TypeLiteral<Set<Inner<Integer>>>() {}; in testParameterizedTypeToString()
41 TypeLiteral<Map<Inner<Long>, Set<Inner<Long>>>> mapInnerLongToSetInnerLong = in testParameterizedTypeToString()
42 new TypeLiteral<Map<Inner<Long>, Set<Inner<Long>>>>() {}; in testParameterizedTypeToString()
50 assertTrue(MoreTypes.equals(new TypeLiteral<T>() {}.getType(), type)); in testEquals_typeVariable()
/external/guice/extensions/multibindings/src/com/google/inject/multibindings/
DMapBinder.java45 import com.google.inject.TypeLiteral;
144 TypeLiteral<K> keyType, TypeLiteral<V> valueType) { in newMapBinder()
156 return newMapBinder(binder, TypeLiteral.get(keyType), TypeLiteral.get(valueType)); in newMapBinder()
164 TypeLiteral<K> keyType, TypeLiteral<V> valueType, Annotation annotation) { in newMapBinder()
177 return newMapBinder(binder, TypeLiteral.get(keyType), TypeLiteral.get(valueType), annotation); in newMapBinder()
184 public static <K, V> MapBinder<K, V> newMapBinder(Binder binder, TypeLiteral<K> keyType, in newMapBinder()
185 TypeLiteral<V> valueType, Class<? extends Annotation> annotationType) { in newMapBinder()
199 binder, TypeLiteral.get(keyType), TypeLiteral.get(valueType), annotationType); in newMapBinder()
203 static <K, V> TypeLiteral<Map<K, V>> mapOf( in mapOf()
204 TypeLiteral<K> keyType, TypeLiteral<V> valueType) { in mapOf()
[all …]
DOptionalBinder.java35 import com.google.inject.TypeLiteral;
198 public static <T> OptionalBinder<T> newOptionalBinder(Binder binder, TypeLiteral<T> type) { in newOptionalBinder()
214 static <T> TypeLiteral<Optional<T>> optionalOf( in optionalOf()
215 TypeLiteral<T> type) { in optionalOf()
216 return (TypeLiteral<Optional<T>>) TypeLiteral.get( in optionalOf()
220 static <T> TypeLiteral<?> javaOptionalOf( in javaOptionalOf()
221 TypeLiteral<T> type) { in javaOptionalOf()
223 return TypeLiteral.get(Types.newParameterizedType(JAVA_OPTIONAL_CLASS, type.getType())); in javaOptionalOf()
227 static <T> TypeLiteral<Optional<javax.inject.Provider<T>>> optionalOfJavaxProvider( in optionalOfJavaxProvider()
228 TypeLiteral<T> type) { in optionalOfJavaxProvider()
[all …]
DMultibinder.java40 import com.google.inject.TypeLiteral;
123 public static <T> Multibinder<T> newSetBinder(Binder binder, TypeLiteral<T> type) { in newSetBinder()
140 Binder binder, TypeLiteral<T> type, Annotation annotation) { in newSetBinder()
157 public static <T> Multibinder<T> newSetBinder(Binder binder, TypeLiteral<T> type, in newSetBinder()
193 static <T> TypeLiteral<Set<T>> setOf(TypeLiteral<T> elementType) { in setOf()
195 return (TypeLiteral<Set<T>>) TypeLiteral.get(type); in setOf()
199 static <T> TypeLiteral<Collection<Provider<T>>> collectionOfProvidersOf( in collectionOfProvidersOf()
200 TypeLiteral<T> elementType) { in collectionOfProvidersOf()
203 return (TypeLiteral<Collection<Provider<T>>>) TypeLiteral.get(type); in collectionOfProvidersOf()
207 static <T> TypeLiteral<Collection<javax.inject.Provider<T>>> collectionOfJavaxProvidersOf( in collectionOfJavaxProvidersOf()
[all …]
/external/guice/extensions/testlib/src/com/google/inject/testing/fieldbinder/
DBoundFieldModule.java25 import com.google.inject.TypeLiteral;
137 final TypeLiteral<?> type;
148 final TypeLiteral<?> boundType;
159 final Optional<TypeLiteral<?>> naturalType;
164 TypeLiteral<?> fieldType) { in BoundFieldInfo()
175 private TypeLiteral<?> getBoundType() { in getBoundType()
189 return TypeLiteral.get(bindClass); in getBoundType()
204 private Optional<TypeLiteral<?>> getNaturalFieldType() { in getNaturalFieldType()
213 return Optional.<TypeLiteral<?>>of(TypeLiteral.get(providerTypeArguments[0])); in getNaturalFieldType()
215 return Optional.<TypeLiteral<?>>of(type); in getNaturalFieldType()
[all …]
/external/guice/core/src/com/google/inject/spi/
DInjectionPoint.java27 import com.google.inject.TypeLiteral;
66 private final TypeLiteral<?> declaringType;
69 InjectionPoint(TypeLiteral<?> declaringType, Method method, boolean optional) { in InjectionPoint()
76 InjectionPoint(TypeLiteral<?> declaringType, Constructor<?> constructor) { in InjectionPoint()
84 InjectionPoint(TypeLiteral<?> declaringType, Field field, boolean optional) { in InjectionPoint()
106 private ImmutableList<Dependency<?>> forMember(Member member, TypeLiteral<?> type, in forMember()
114 for (TypeLiteral<?> parameterType : type.getParameterTypes(member)) { in forMember()
181 public TypeLiteral<?> getDeclaringType() { in getDeclaringType()
209 return new InjectionPoint(TypeLiteral.get(constructor.getDeclaringClass()), constructor); in forConstructor()
221 Constructor<T> constructor, TypeLiteral<? extends T> type) { in forConstructor()
[all …]
DTypeListenerBinding.java20 import com.google.inject.TypeLiteral;
36 private final Matcher<? super TypeLiteral<?>> typeMatcher;
40 Matcher<? super TypeLiteral<?>> typeMatcher) { in TypeListenerBinding()
52 public Matcher<? super TypeLiteral<?>> getTypeMatcher() { in getTypeMatcher()
/external/guice/core/test/com/google/inject/spi/
DInjectionPointTest.java31 import com.google.inject.TypeLiteral;
60 TypeLiteral<?> typeLiteral = TypeLiteral.get(getClass()); in testFieldInjectionPoint()
83 TypeLiteral<?> typeLiteral = TypeLiteral.get(getClass()); in testMethodInjectionPoint()
107 TypeLiteral<?> typeLiteral = TypeLiteral.get(Constructable.class); in testConstructorInjectionPoint()
143 TypeLiteral<HashSet<String>> hashSet = new TypeLiteral<HashSet<String>>() {}; in testForConstructor()
151 InjectionPoint.forConstructor(constructor, new TypeLiteral<LinkedHashSet<String>>() {}); in testForConstructor()
159 InjectionPoint.forConstructor((Constructor) constructor, new TypeLiteral<Set<String>>() {}); in testForConstructor() method
176 TypeLiteral<HasInjections> type = TypeLiteral.get(HasInjections.class); in testAddForInstanceMethodsAndFields()
190 new InjectionPoint(TypeLiteral.get(HasInjections.class), staticMethod, false), in testAddForStaticMethodsAndFields()
191 new InjectionPoint(TypeLiteral.get(HasInjections.class), staticField, false)), in testAddForStaticMethodsAndFields()
[all …]
DInjectorSpiTest.java10 import com.google.inject.TypeLiteral;
44 assertTrue(injector.getAllBindings().containsKey(Key.get(new TypeLiteral<Provider<Foo>>() {}))); in testExistingBinding()
45 binding = injector.getExistingBinding(Key.get(new TypeLiteral<Provider<Foo>>() {})); in testExistingBinding()
57 …assertFalse(injector.getAllBindings().containsKey(Key.get(new TypeLiteral<Provider<Baz>>() {}))); … in testExistingBinding()
58 binding = injector.getExistingBinding(Key.get(new TypeLiteral<Provider<Baz>>() {})); in testExistingBinding()
67 assertNull(injector.getExistingBinding(Key.get(new TypeLiteral<Provider<Bar>>() {}))); in testExistingBinding()
/external/guice/extensions/throwingproviders/test/com/google/inject/throwingproviders/
DCheckedProviderMethodsModuleTest.java27 import com.google.inject.TypeLiteral;
43 private final TypeLiteral<RpcProvider<String>> rpcProviderOfString
44 = new TypeLiteral<RpcProvider<String>>() { };
45 private final TypeLiteral<RpcProvider<Integer>> rpcProviderOfInteger
46 = new TypeLiteral<RpcProvider<Integer>>() { };
47 private final TypeLiteral<RpcProvider<Long>> rpcProviderOfLong
48 = new TypeLiteral<RpcProvider<Long>>() { };
49 private final TypeLiteral<RpcProvider<Float>> rpcProviderOfFloat
50 = new TypeLiteral<RpcProvider<Float>>() { };
51 private final TypeLiteral<RpcProvider<Pair<Double, String>>> rpcProviderOfPair
[all …]
/external/guice/extensions/throwingproviders/src/com/google/inject/throwingproviders/
DCheckedProviderMethodsModule.java27 import com.google.inject.TypeLiteral;
51 private final TypeLiteral<?> typeLiteral;
55 this.typeLiteral = TypeLiteral.get(this.delegate.getClass()); in CheckedProviderMethodsModule()
99 List<TypeLiteral<?>> parameterTypes = typeLiteral.getParameterTypes(method); in createProviderMethod()
116 TypeLiteral<T> returnType = (TypeLiteral<T>) typeLiteral.getReturnType(method); in createProviderMethod()
117 List<TypeLiteral<?>> exceptionTypes = typeLiteral.getExceptionTypes(method); in createProviderMethod()
132 <T> Key<T> getKey(Errors errors, TypeLiteral<T> type, Member member, Annotation[] annotations) { in getKey()
DThrowingProviderBinder.java32 import com.google.inject.TypeLiteral;
88 private static final TypeLiteral<CheckedProvider<?>> CHECKED_PROVIDER_TYPE
89 = new TypeLiteral<CheckedProvider<?>>() { };
91 private static final TypeLiteral<CheckedProviderMethod<?>> CHECKED_PROVIDER_METHOD_TYPE
92 = new TypeLiteral<CheckedProviderMethod<?>>() { };
136 bind(Class<P> interfaceType, TypeLiteral<T> typeLiteral) { in bind()
210 return providing(TypeLiteral.get(cxtorClass)); in providing()
215 public ScopedBindingBuilder providing(TypeLiteral<? extends T> cxtorLiteral) { in providing()
385 List<TypeLiteral<?>> exceptionLiterals =
386 TypeLiteral.get(interfaceType).getExceptionTypes(getMethod);
[all …]

1234