Examples of ParameterizedTypeImpl


Examples of com.alibaba.fastjson.util.ParameterizedTypeImpl

    public void test_null() throws Exception {
        FieldInfo fieldInfo = new FieldInfo("getValue", Entity.class.getMethod("getValue"), null);
        Assert.assertEquals(null, fieldInfo.getAnnotation(JSONField.class));

        Field field = GenericFieldEntity.class.getField("value");
        Type type = new ParameterizedTypeImpl(new Type[] { ValueObject.class }, null, GenericFieldEntity.class);
        FieldInfo fieldInfoOfField = new FieldInfo("value", null, field, GenericFieldEntity.class, type);
        Assert.assertEquals(fieldInfoOfField.getFieldType(), ValueObject.class);
        Assert.assertEquals(fieldInfoOfField.getFieldClass(), ValueObject.class);

        field = GenericListFieldEntity.class.getField("value");
        type = new ParameterizedTypeImpl(new Type[] { ValueObject.class }, null, GenericListFieldEntity.class);
        FieldInfo fieldInfoOfListField = new FieldInfo("value", null, field, GenericListFieldEntity.class, type);
        ParameterizedTypeImpl actualFieldType = (ParameterizedTypeImpl) fieldInfoOfListField.getFieldType();
        Assert.assertEquals(actualFieldType.getActualTypeArguments()[0], ValueObject.class);
        Assert.assertEquals(actualFieldType.getRawType(), List.class);
        Assert.assertEquals(fieldInfoOfListField.getFieldClass(), List.class);
        Assert.assertEquals(null, ((ParameterizedTypeImpl) type).getOwnerType());

        Method method = GenericSetterEntity.class.getMethod("setValue", Object.class);
        type = new ParameterizedTypeImpl(new Type[] { ValueObject.class }, null, GenericSetterEntity.class);
        FieldInfo fieldInfoOfSetter = new FieldInfo("value", method, null, GenericSetterEntity.class, type);
        Assert.assertEquals(fieldInfoOfSetter.getFieldType(), ValueObject.class);
        Assert.assertEquals(fieldInfoOfSetter.getFieldClass(), ValueObject.class);
       
        fieldInfoOfSetter.toString();

        method = GenericListSetterEntity.class.getMethod("setValue", List.class);
        type = new ParameterizedTypeImpl(new Type[] { ValueObject.class }, null, GenericListSetterEntity.class);
        FieldInfo fieldInfoOfListSetter = new FieldInfo("value", method, null, GenericListSetterEntity.class, type);
        Assert.assertEquals(actualFieldType.getActualTypeArguments()[0], ValueObject.class);
        Assert.assertEquals(actualFieldType.getRawType(), List.class);
        Assert.assertEquals(fieldInfoOfListSetter.getFieldClass(), List.class);
    }
View Full Code Here

Examples of com.google.inject.internal.MoreTypes.ParameterizedTypeImpl

    public void bindListJsonCodec(Class<?> type)
    {
        Preconditions.checkNotNull(type, "type is null");

        ParameterizedTypeImpl listType = new ParameterizedTypeImpl(null, List.class, type);
        binder.bind(getJsonCodecKey(listType)).toProvider(new JsonCodecProvider(listType)).in(Scopes.SINGLETON);
    }
View Full Code Here

Examples of com.google.inject.internal.MoreTypes.ParameterizedTypeImpl

    public void bindListJsonCodec(JsonCodec<?> type)
    {
        Preconditions.checkNotNull(type, "type is null");

        ParameterizedTypeImpl listType = new ParameterizedTypeImpl(null, List.class, type.getType());
        binder.bind(getJsonCodecKey(listType)).toProvider(new JsonCodecProvider(listType)).in(Scopes.SINGLETON);
    }
View Full Code Here

Examples of com.google.inject.internal.MoreTypes.ParameterizedTypeImpl

    public void bindMapJsonCodec(Class<?> keyType, Class<?> valueType)
    {
        Preconditions.checkNotNull(keyType, "keyType is null");
        Preconditions.checkNotNull(valueType, "valueType is null");

        ParameterizedTypeImpl mapType = new ParameterizedTypeImpl(null, Map.class, keyType, valueType);
        binder.bind(getJsonCodecKey(mapType)).toProvider(new JsonCodecProvider(mapType)).in(Scopes.SINGLETON);
    }
View Full Code Here

Examples of com.google.inject.internal.MoreTypes.ParameterizedTypeImpl

    public void bindMapJsonCodec(Class<?> keyType, JsonCodec<?> valueType)
    {
        Preconditions.checkNotNull(keyType, "keyType is null");
        Preconditions.checkNotNull(valueType, "valueType is null");

        ParameterizedTypeImpl mapType = new ParameterizedTypeImpl(null, Map.class, keyType, valueType.getType());
        binder.bind(getJsonCodecKey(mapType)).toProvider(new JsonCodecProvider(mapType)).in(Scopes.SINGLETON);
    }
View Full Code Here

Examples of com.google.inject.internal.MoreTypes.ParameterizedTypeImpl

        binder.bind(getJsonCodecKey(mapType)).toProvider(new JsonCodecProvider(mapType)).in(Scopes.SINGLETON);
    }

    private Key<JsonCodec<?>> getJsonCodecKey(Type type)
    {
        return (Key<JsonCodec<?>>) Key.get(new ParameterizedTypeImpl(null, JsonCodec.class, type));
    }
View Full Code Here

Examples of com.google.sitebricks.conversion.generics.ParameterizedTypeImpl

          // the class is not parameterised (generic)
        type = egressClass;
      }
      else {
          // reconstruct the Type from mvel's generics details
        type = new ParameterizedTypeImpl(egressClass, parameters, egressClass.getEnclosingClass());
      }
     
      egressTypes.put(expression, type);
     
      return type;
View Full Code Here

Examples of httl.util.ParameterizedTypeImpl

      if (returnClass != null) {
        if (returnClass.isArray()) {
          type = returnClass.getComponentType();
        } else if (Map.class.isAssignableFrom(returnClass)) {
          if (returnType instanceof ParameterizedType) {
            type = new ParameterizedTypeImpl(Map.Entry.class, ((ParameterizedType) returnType).getActualTypeArguments());
          } else {
            type = Map.Entry.class;
          }
        } else if (Collection.class.isAssignableFrom(returnClass)) {
          type = findGenericType(returnType, 0); // Collection<T>泛型
View Full Code Here

Examples of org.apache.harmony.lang.reflect.implementation.ParameterizedTypeImpl

                            throw new TypeNotPresentException(((InterimParameterizedType) throwns[i]).rawType.classTypeName.substring(1).replace('/', '.'), e);
                        }
                        //check the correspondence of the formal parameter number and the actual argument number:
                        AuxiliaryChecker.checkArgsNumber((InterimParameterizedType) throwns[i], startPoint); // the MalformedParameterizedTypeException may raise here
                        try {
                            pType = new ParameterizedTypeImpl(AuxiliaryCreator.createTypeArgs((InterimParameterizedType) throwns[i], startPoint), AuxiliaryCreator.createRawType((InterimParameterizedType) throwns[i], startPoint), AuxiliaryCreator.createOwnerType((InterimParameterizedType) throwns[i], startPoint));
                        } catch(ClassNotFoundException e) {
                            throw new TypeNotPresentException(e.getMessage(), e);
                        }
                        ParameterizedTypeRepository.registerParameterizedType(pType, (InterimParameterizedType) throwns[i], ((InterimParameterizedType) throwns[i]).signature, startPoint);
                    }
View Full Code Here

Examples of org.apache.harmony.lang.reflect.implementation.ParameterizedTypeImpl

                            (InterimParameterizedType) methodParameters[i],
                            startPoint); // the
                                            // MalformedParameterizedTypeException
                                            // may raise here
                    try {
                        pType = new ParameterizedTypeImpl(
                                AuxiliaryCreator
                                        .createTypeArgs(
                                                (InterimParameterizedType) methodParameters[i],
                                                startPoint),
                                AuxiliaryCreator
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.