Package java.lang.reflect

Examples of java.lang.reflect.ParameterizedType


   {
      if (!MultivaluedMap.class.isAssignableFrom(type)) return false;
      if (genericType == null) return true;

      if (!(genericType instanceof ParameterizedType)) return false;
      ParameterizedType params = (ParameterizedType) genericType;
      if (params.getActualTypeArguments().length != 2) return false;
      return params.getActualTypeArguments()[0].equals(String.class) && params.getActualTypeArguments()[1].equals(String.class);
   }
View Full Code Here


   {
      if (!MultivaluedMap.class.isAssignableFrom(type)) return false;
      if (genericType == null) return true;

      if (!(genericType instanceof ParameterizedType)) return false;
      ParameterizedType params = (ParameterizedType) genericType;
      if (params.getActualTypeArguments().length != 2) return false;
      return params.getActualTypeArguments()[0].equals(String.class) && params.getActualTypeArguments()[1].equals(String.class);
   }
View Full Code Here

        }

        String elementType = null;
        if (genericType instanceof ParameterizedType)
        {
            ParameterizedType paramtype = (ParameterizedType)genericType;
            if (paramtype.getActualTypeArguments().length == 1)
            {
                if (paramtype.getActualTypeArguments()[0] instanceof Class)
                {
                    elementType = ((Class)paramtype.getActualTypeArguments()[0]).getName();
                }
            }
        }
        return elementType;
    }
View Full Code Here

        }

        String elementType = null;
        if (method.getGenericReturnType() instanceof ParameterizedType)
        {
            ParameterizedType paramtype = (ParameterizedType)method.getGenericReturnType();
            if (paramtype.getActualTypeArguments().length == 1)
            {
                if (paramtype.getActualTypeArguments()[0] instanceof Class)
                {
                    elementType = ((Class)paramtype.getActualTypeArguments()[0]).getName();
                }
            }
        }
        return elementType;
    }
View Full Code Here

        }

        String keyType = null;
        if (genericType instanceof ParameterizedType)
        {
            ParameterizedType paramtype = (ParameterizedType)genericType;
            if (paramtype.getActualTypeArguments().length == 2)
            {
                if (paramtype.getActualTypeArguments()[0] instanceof Class)
                {
                    keyType = ((Class)paramtype.getActualTypeArguments()[0]).getName();
                }
            }
        }
        return keyType;
    }   
View Full Code Here

        }

        String keyType = null;
        if (method.getGenericReturnType() instanceof ParameterizedType)
        {
            ParameterizedType paramtype = (ParameterizedType)method.getGenericReturnType();
            if (paramtype.getActualTypeArguments().length == 2)
            {
                if (paramtype.getActualTypeArguments()[0] instanceof Class)
                {
                    keyType = ((Class)paramtype.getActualTypeArguments()[0]).getName();
                }
            }
        }
        return keyType;
    }
View Full Code Here

        }

        String valueType = null;
        if (genericType instanceof ParameterizedType)
        {
            ParameterizedType paramtype = (ParameterizedType)genericType;
            if (paramtype.getActualTypeArguments().length == 2)
            {
                if (paramtype.getActualTypeArguments()[1] instanceof Class)
                {
                    valueType = ((Class)paramtype.getActualTypeArguments()[1]).getName();
                }
            }
        }
        return valueType;
    }
View Full Code Here

        }

        String valueType = null;
        if (method.getGenericReturnType() instanceof ParameterizedType)
        {
            ParameterizedType paramtype = (ParameterizedType)method.getGenericReturnType();
            if (paramtype.getActualTypeArguments().length == 2)
            {
                if (paramtype.getActualTypeArguments()[1] instanceof Class)
                {
                    valueType = ((Class)paramtype.getActualTypeArguments()[1]).getName();
                }
            }
        }
        return valueType;
    }
View Full Code Here

  public static int getGenericlyTypeCount(Field field) {

    if (field.getGenericType() instanceof ParameterizedType) {

      ParameterizedType type = (ParameterizedType) field.getGenericType();

      return type.getActualTypeArguments().length;
    }

    return 0;
  }
View Full Code Here

      {
         if (!List.class.isAssignableFrom(type))
            return false;
         if (!(genericType instanceof ParameterizedType))
            return false;
         ParameterizedType pt = (ParameterizedType) genericType;
         boolean result = pt.getActualTypeArguments()[0].equals(Float.class);
         System.out.println("FloatWriter result!!!: " + result);
         return result;
      }
View Full Code Here

TOP

Related Classes of java.lang.reflect.ParameterizedType

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.