Package java.lang.reflect

Examples of java.lang.reflect.ParameterizedType


            return false;
         System.out.println("DoubleWriter: " + genericType);
         if (!(genericType instanceof ParameterizedType))
            return false;
         System.out.println("DoubleWriter");
         ParameterizedType pt = (ParameterizedType) genericType;
         boolean result = pt.getActualTypeArguments()[0].equals(Double.class);
         System.out.println("Doublewriter result!!!: " + result);
         return result;
      }
View Full Code Here


            HasMany hasMany = f.getAnnotation(HasMany.class);
            if (hasMany != null){
                HasManyField field = new HasManyField();
                field.setName(f.getName());
                field.setAnnotation(hasMany);
                ParameterizedType ptype = (ParameterizedType)f.getGenericType();
                Class<?> childClass = (Class<?>)ptype.getActualTypeArguments()[0];
                if (hasMany.foreignKey().equals("")){
                    field.setForeignKey(orm.table+"_id");
                }
                else{
                    field.setForeignKey(hasMany.foreignKey());
View Full Code Here

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

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

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

    boolean isValidType(Type c) {
        if (c == AtmosphereResource.class) return true;

        if (instanceof ParameterizedType){
            ParameterizedType pt = (ParameterizedType) c;
            if (pt.getRawType() != AtmosphereResource.class) return false;

            if (pt.getActualTypeArguments().length != 2) return false;

            if (pt.getActualTypeArguments()[0] != HttpServletRequest.class) return false;
            if (pt.getActualTypeArguments()[1] != HttpServletResponse.class) return false;

            return true;
        }
        return false;
    }
View Full Code Here

      if (type instanceof Class) {
        // there is no useful information for us in raw types, so just
        // keep going.
        type = ((Class) type).getGenericSuperclass();
      } else {
        ParameterizedType parameterizedType = (ParameterizedType) type;
        Class<?> rawType = (Class) parameterizedType.getRawType();

        Type[] actualTypeArguments = parameterizedType
            .getActualTypeArguments();
        TypeVariable<?>[] typeParameters = rawType.getTypeParameters();
        for (int i = 0; i < actualTypeArguments.length; i++) {
          resolvedTypes
              .put(typeParameters[i], actualTypeArguments[i]);
View Full Code Here

    @SuppressWarnings("unchecked")
    private Object execute(Select s, Method method, Object[] args, Foo f)
    {
        Type t = method.getGenericReturnType();
        assert(t instanceof ParameterizedType);
        ParameterizedType returnType = (ParameterizedType) t;
        final Type[] h = returnType.getActualTypeArguments();
        assert(h.length == 1);
        assert(h[0] instanceof Class);
        Class c = (Class) h[0];
        Query q = handle.createQuery(s.value()).map(c);
        if (args != null) bindArguments(method.isAnnotationPresent(BindBy.class) ?
View Full Code Here

            return null;
        }

        if (genericType instanceof ParameterizedType)
        {
            ParameterizedType paramtype = (ParameterizedType)genericType;
            if (paramtype.getActualTypeArguments().length == 1)
            {
                Type argType = paramtype.getActualTypeArguments()[0];
                if (argType instanceof Class)
                {
                    return (Class) argType;
                }
                else if (argType instanceof ParameterizedType)
View Full Code Here

            return null;
        }

        if (genericType instanceof ParameterizedType)
        {
            ParameterizedType paramtype = (ParameterizedType)genericType;
            if (paramtype.getActualTypeArguments().length == 2)
            {
                Type argType = paramtype.getActualTypeArguments()[0];
                if (argType instanceof Class)
                {
                    return (Class) argType;
                }
                else if (argType instanceof ParameterizedType)
View Full Code Here

            return null;
        }

        if (genericType instanceof ParameterizedType)
        {
            ParameterizedType paramtype = (ParameterizedType)genericType;
            if (paramtype.getActualTypeArguments().length == 2)
            {
                Type argType = paramtype.getActualTypeArguments()[1];
                if (argType instanceof Class)
                {
                    return (Class) argType;
                }
                else if (argType instanceof ParameterizedType)
View Full Code Here

   * @return The Class<?> of generic type if any, otherwise null
   */
  public static Class<?> getGenericMultivalueType(final Field p) {
    final Type genericType = p.getGenericType();
    if (genericType != null && genericType instanceof ParameterizedType) {
      final ParameterizedType pt = (ParameterizedType) genericType;
      if (pt.getActualTypeArguments() != null && pt.getActualTypeArguments().length > 0) {
        if (pt.getActualTypeArguments()[0] instanceof Class<?>) {
          return (Class<?>) pt.getActualTypeArguments()[0];
        }
      }
    }
    return null;
  }
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.