Package java.lang.reflect

Examples of java.lang.reflect.Type


  return matched;
    }

    @Override
    public <T> Template<T> buildTemplate(Type arrayType) {
  Type baseType;
  Class<?> baseClass;
  int dim = 1;
  if (arrayType instanceof GenericArrayType) {
      GenericArrayType type = (GenericArrayType) arrayType;
      baseType = type.getGenericComponentType();
View Full Code Here


            };
         }
      }
      else
      {
         final Type methodGenericReturnType = method.getGenericReturnType();
         if (methodGenericReturnType instanceof ParameterizedType)
         {
            final ParameterizedType zType = (ParameterizedType) methodGenericReturnType;
            final Type genericReturnType = zType.getActualTypeArguments()[0];
            final Class<?> responseReturnType = Types.getRawType(genericReturnType);
            return new EntityExtractor()
            {
               public Object extractEntity(ClientRequestContext context, Object... args)
               {
View Full Code Here

      for (Field field : clazz.getDeclaredFields())
      {
         Annotation[] annotations = field.getAnnotations();
         if (annotations == null || annotations.length == 0) continue;
         Class<?> type = field.getType();
         Type genericType = field.getGenericType();

         ValueInjector extractor = getParameterExtractor(clazz, factory, field, annotations, type, genericType);
         if (extractor != null)
         {
            if (!Modifier.isPublic(field.getModifiers())) field.setAccessible(true);
            fieldMap.put(field, extractor);
         }
      }
      for (Method method : clazz.getDeclaredMethods())
      {
         if (!method.getName().startsWith("set")) continue;
         if (method.getParameterTypes().length != 1) continue;

         Annotation[] annotations = method.getAnnotations();
         if (annotations == null || annotations.length == 0) continue;

         Class<?> type = method.getParameterTypes()[0];
         Type genericType = method.getGenericParameterTypes()[0];

         ValueInjector extractor = getParameterExtractor(clazz, factory, method, annotations, type, genericType);
         if (extractor != null)
         {
            long hash = 0;
View Full Code Here

   private void processInjector(final Injector injector)
   {
      for (final Binding<?> binding : injector.getBindings().values())
      {
         final Type type = binding.getKey().getTypeLiteral().getType();
         if (type instanceof Class)
         {
            final Class<?> beanClass = (Class) type;
            if (GetRestful.isRootResource(beanClass))
            {
View Full Code Here

      throw new IllegalArgumentException("Reader = " + this
          + " recived genericType = " + genericType
          + ", but it is not instance of " + ParameterizedType.class);

    ParameterizedType param = (ParameterizedType) genericType;
    Type baseType = param.getActualTypeArguments()[1];
    Class<?> rawType = Types.getRawType(baseType);

    MultipartFormDataInputImpl input = new MultipartFormDataInputImpl(
        mediaType, workers);
    input.parse(entityStream);
View Full Code Here

      addExceptionMapper(provider);
   }

   public void addExceptionMapper(ExceptionMapper provider)
   {
      Type exceptionType = Types.getActualTypeArgumentsOfAnInterface(provider.getClass(), ExceptionMapper.class)[0];
      addExceptionMapper(provider, exceptionType);
   }
View Full Code Here

      addContextResolver(provider, false);
   }

   public void addContextResolver(ContextResolver provider, boolean builtin)
   {
      Type parameter = Types.getActualTypeArgumentsOfAnInterface(provider.getClass(), ContextResolver.class)[0];
      addContextResolver(provider, parameter, builtin);
   }
View Full Code Here

      addStringConverter(writer);
   }

   public void addStringConverter(StringConverter provider)
   {
      Type parameter = Types.getActualTypeArgumentsOfAnInterface(provider.getClass(), StringConverter.class)[0];
      addStringConverter(provider, parameter);
   }
View Full Code Here

      if (accepts == null || accepts.size() == 0 || entity == null)
      {
         return MediaType.WILDCARD_TYPE;
      }
      Class clazz = entity.getClass();
      Type type = null;
      if (entity instanceof GenericEntity)
      {
         GenericEntity gen = (GenericEntity) entity;
         clazz = gen.getRawType();
         type = gen.getType();
View Full Code Here

       */
      Type[] genericParameterTypes = Types.getGenericParameterTypesOfGenericInterfaceMethod(root, method);
      for (int i = 0; i < method.getParameterTypes().length; i++)
      {
         Class<?> type;
         Type genericType;

         // the parameter type might be a type variable defined in a superclass
         if (genericParameterTypes[i] instanceof TypeVariable<?>)
         {
            // try to find out the value of the type variable
View Full Code Here

TOP

Related Classes of java.lang.reflect.Type

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.