Package com.google.common.reflect

Examples of com.google.common.reflect.TypeResolver$TypeTable


   @SuppressWarnings("unchecked")
   public <X, Y> TypeToken<T> where(TypeParameter2<X> typeParam1,
         TypeToken<X> typeArg1, TypeParameter2<Y> typeParam2, TypeToken<Y> typeArg2) {
      // resolving both parameters in one shot seems to work around 1635
      TypeResolver resolver = new TypeResolver();
      // where(Map) is package-private in TypeResolver
      Invokable<TypeResolver, TypeResolver> whereWithMap =
            Reflection2.<TypeResolver, TypeResolver>method(TypeResolver.class, "where",
                  Map.class);
      try {
         resolver = whereWithMap.invoke(resolver, ImmutableMap.of(
               typeParam1.getTypeVariable(), typeArg1.getType(),
               typeParam2.getTypeVariable(), typeArg2.getType()));
      } catch (IllegalAccessException exception) {
         // should never happen
         throw new IllegalStateException(exception);
      } catch (InvocationTargetException exception) {
         // should never happen
         throw new IllegalStateException(exception);
      }
      return (TypeToken<T>) TypeToken.of(resolver.resolveType(getType()));
   }
View Full Code Here


   @SuppressWarnings("unchecked")
   public <X, Y> TypeToken<T> where(TypeParameter2<X> typeParam1,
         TypeToken<X> typeArg1, TypeParameter2<Y> typeParam2, TypeToken<Y> typeArg2) {
      // resolving both parameters in one shot seems to work around 1635
      TypeResolver resolver = new TypeResolver();
      // where(Map) is package-private in TypeResolver
      Invokable<TypeResolver, TypeResolver> whereWithMap =
            Reflection2.<TypeResolver, TypeResolver>method(TypeResolver.class, "where",
                  Map.class);
      try {
         resolver = whereWithMap.invoke(resolver, ImmutableMap.of(
               typeParam1.getTypeVariable(), typeArg1.getType(),
               typeParam2.getTypeVariable(), typeArg2.getType()));
      } catch (IllegalAccessException exception) {
         // should never happen
         throw new IllegalStateException(exception);
      } catch (InvocationTargetException exception) {
         // should never happen
         throw new IllegalStateException(exception);
      }
      return (TypeToken<T>) TypeToken.of(resolver.resolveType(getType()));
   }
View Full Code Here

            };
        }

        @SuppressWarnings("unchecked")
        public <I> Builder<T> where(Parameter<I> parameter, ModelType<I> type) {
            TypeResolver resolver = new TypeResolver().where(parameter.typeVariable, type.typeToken.getType());
            typeToken = (TypeToken<T>) TypeToken.of(resolver.resolveType(typeToken.getType()));
            return this;
        }
View Full Code Here

TOP

Related Classes of com.google.common.reflect.TypeResolver$TypeTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.