Home | History | Annotate | Download | only in reflect

Lines Matching defs:of

6  * You may obtain a copy of the License at
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
61 * TypeToken.of(method.getGenericReturnType())}.
66 * of the {@code listType()} method signature; while {@code <String>} is lost in erasure:
103 * Constructs a new type token of {@code T}.
118 "If you do need to create a TypeToken of a type variable, " +
119 "please use TypeToken.of() instead.", runtimeType);
123 * Constructs a new type token of {@code T} while resolving free type variables in the context of
144 this.runtimeType = of(declaringClass).resolveType(captured).runtimeType;
152 /** Returns an instance of type token that wraps {@code type}. */
153 public static <T> TypeToken<T> of(Class<T> type) {
157 /** Returns an instance of type token that wraps {@code type}. */
158 public static TypeToken<?> of(Type type) {
163 * Returns the raw type of {@code T}. Formally speaking, if {@code T} is returned by
165 * {@link java.lang.reflect.Method#getReturnType} of the same method object. Specifically:
168 * <li>If {@code T} is a {@link ParameterizedType}, the raw type of the parameterized type is
172 * <li>If {@code T} is a type variable or a wildcard type, the raw type of the first upper bound
184 * Returns the raw type of the class or parameterized type; if {@code T} is type variable or
185 * wildcard type, the raw types of all its upper bounds are returned.
216 .where(ImmutableMap.of(
239 return where(typeParam, of(typeArg));
255 return of(resolver.resolveType(type));
267 // super types' type mapping is a subset of type mapping of this type.
273 * Returns the generic superclass of this type or {@code null} if the type represents
299 @SuppressWarnings("unchecked") // super class of T
305 TypeToken<?> token = of(bound);
309 @SuppressWarnings("unchecked") // only upper bound of T is passed in.
335 @SuppressWarnings("unchecked") // interface of T
346 @SuppressWarnings("unchecked") // upper bound of T
347 TypeToken<? super T> boundType = (TypeToken<? super T>) of(bound);
356 * Returns the set of interfaces and classes that this type is or is a subtype of. The returned
360 * necessarily a subtype of all the types following. Order between types without subtype
371 * Returns the generic form of {@code superclass}. For example, if this is
377 "%s is not a super class of %s", superclass, this);
394 * Returns subtype of {@code this} with {@code subclass} as the raw class.
400 "Cannot get subtype of type variable <%s>", this);
405 "%s isn't a subclass of %s", subclass, this);
412 of(resolveTypeArgsForSubclass(subclass));
435 * Returns true if this type is one of the nine primitive types (including {@code void}).
453 return TypeToken.of(Primitives.wrap(type));
472 return TypeToken.of(Primitives.unwrap(type));
486 return of(componentType);
490 * Returns the {@link Invokable} for {@code method}, which must be a member of {@code T}.
495 checkArgument(of(method.getDeclaringClass()).isAssignableFrom(this),
517 * Returns the {@link Invokable} for {@code constructor}, which must be a member of {@code T}.
544 * The set of interfaces and classes that {@code T} is or is a subtype of. {@link Object} is not
578 /** Returns the raw types of the types in this set, in the same order. */
714 /** Implemented to support serialization of subclasses. */
718 return of(new TypeResolver().resolveType(runtimeType));
753 // if "from" is type variable, it's assignable if any of its "extends"
758 // if "from" is wildcard, it'a assignable to "to" if any of its "extends"
820 TypeToken<?> fromTypeToken = of(from);
946 * Returns the type token representing the generic type declaration of {@code cls}. For example:
949 * <p>If {@code cls} isn't parameterized and isn't a generic array, the type token of the class is
958 TypeToken<? extends T> result = (TypeToken<? extends T>) of(arrayOfGenericType);
965 of(Types.newParameterizedType(cls, typeParams));
968 return of(cls);
976 TypeToken<? super T> bound = (TypeToken<? super T>) of(upperBound);
977 if (of(supertype).isAssignableFrom(bound)) {
983 throw new IllegalArgumentException(supertype + " isn't a super type of " + this);
989 TypeToken<? extends T> bound = (TypeToken<? extends T>) of(lowerBound);
993 throw new IllegalArgumentException(subclass + " isn't a subclass of " + this);
1001 "%s isn't a super type of %s", supertype, this);
1008 of(newArrayClassOrGenericArrayType(componentSupertype.runtimeType));
1019 of(newArrayClassOrGenericArrayType(componentSubtype.runtimeType));
1105 return ImmutableSet.of();
1120 return collectTypes(ImmutableList.of(type));