当前位置: 首页>>代码示例>>Java>>正文


Java AnnotatedType.getType方法代码示例

本文整理汇总了Java中java.lang.reflect.AnnotatedType.getType方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotatedType.getType方法的具体用法?Java AnnotatedType.getType怎么用?Java AnnotatedType.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.reflect.AnnotatedType的用法示例。


在下文中一共展示了AnnotatedType.getType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compileParameters

import java.lang.reflect.AnnotatedType; //导入方法依赖的package包/类
private void compileParameters(AnnotatedType[] annotatedParameterTypes, Annotation[][] annotations) {
	ImmutableList.Builder<String> parameterOrderBuilder = ImmutableList.builder();
	ImmutableMap.Builder<String, Type> nameToTypeBuilder = ImmutableMap.builder();

	for (int x = 0; x < annotatedParameterTypes.length; ++x) {
		AnnotatedType annotatedType = annotatedParameterTypes[x];
		PathParam pathParam = getPathParam(annotations[x]);
		String name;
		Type type;
		if (pathParam != null) {
			name = pathParam.value();
			type = annotatedType.getType();
		} else {
			name = NAME_ENTITY;
			type = annotatedType.getType();
		}
		parameterOrderBuilder.add(name);
		nameToTypeBuilder.put(name, type);
	}
	parameterOrder = parameterOrderBuilder.build();
	parameterNameToType = nameToTypeBuilder.build();
}
 
开发者ID:greensopinion,项目名称:greenbeans,代码行数:23,代码来源:Handler.java

示例2: getMappableType

import java.lang.reflect.AnnotatedType; //导入方法依赖的package包/类
public AnnotatedType getMappableType(AnnotatedType type) {
    InputConverter converter = this.getInputConverter(type);
    if (converter != null) {
        return getMappableType(converter.getSubstituteType(type));
    }
    if (type.getType() instanceof Class) {
        return type;
    }
    if (type instanceof AnnotatedParameterizedType) {
        AnnotatedParameterizedType parameterizedType = (AnnotatedParameterizedType) type;
        AnnotatedType[] arguments = Arrays.stream(parameterizedType.getAnnotatedActualTypeArguments())
                .map(this::getMappableType)
                .toArray(AnnotatedType[]::new);
        return TypeFactory.parameterizedAnnotatedClass(GenericTypeReflector.erase(type.getType()), type.getAnnotations(), arguments);
    }
    throw new IllegalArgumentException("Can not deserialize type: " + type.getType().getTypeName());
}
 
开发者ID:leangen,项目名称:graphql-spqr,代码行数:18,代码来源:ConverterRepository.java

示例3: resolveType

import java.lang.reflect.AnnotatedType; //导入方法依赖的package包/类
public static Type resolveType(Class<?> funcInterface, Type genericReturnType) {
    for (Class<?> interfaceClass : funcInterface.getInterfaces()) {
        final TypeVariable<? extends Class<?>>[] typeParameters = interfaceClass.getTypeParameters();
        for (int i = 0; i < typeParameters.length; i++) {
            for (AnnotatedType annotatedInterface : funcInterface.getAnnotatedInterfaces()) {
                final Type type = annotatedInterface.getType();
                if (type instanceof ParameterizedTypeImpl) {
                    if (((ParameterizedTypeImpl) type).getRawType().equals(interfaceClass)) {
                        return ((ParameterizedTypeImpl) type).getActualTypeArguments()[i];
                    }
                }
            }
        }
    }
    return genericReturnType;
}
 
开发者ID:StefanLiebenberg,项目名称:throwable-interfaces,代码行数:17,代码来源:TypeResolver.java

示例4: getRawType

import java.lang.reflect.AnnotatedType; //导入方法依赖的package包/类
public static Class<?> getRawType(final AnnotatedType annotatedType) {
    final Type containerType = annotatedType.getType();
    if (containerType instanceof Class) {
        return (Class<?>) containerType;
    } else if (containerType instanceof ParameterizedType) {
        return (Class<?>) ((ParameterizedType) containerType).getRawType();
    } else {
        throw new ValidationException("Unknown type: " + containerType.getClass());
    }
}
 
开发者ID:minijax,项目名称:minijax,代码行数:11,代码来源:ReflectionUtils.java

示例5: name

import java.lang.reflect.AnnotatedType; //导入方法依赖的package包/类
@Override
public String name()
{
  AnnotatedType annType = api();
  Type type = annType.getType();
  
  if (type instanceof Class) {
    Class<?> cl = (Class<?>) type;
    
    return "anon:" + cl.getSimpleName();
  }
  else {
    return "anon:" + type;
  }
}
 
开发者ID:baratine,项目名称:baratine,代码行数:16,代码来源:StubAmpBase.java

示例6: fromInput

import java.lang.reflect.AnnotatedType; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T> T fromInput(Object graphQlInput, Type sourceType, AnnotatedType outputType) {
    if (graphQlInput.getClass() == outputType.getType()) {
        return (T) graphQlInput;
    }
    JsonElement jsonElement = gson.toJsonTree(graphQlInput, sourceType);
    return gson.fromJson(jsonElement, outputType.getType());
}
 
开发者ID:leangen,项目名称:graphql-spqr,代码行数:10,代码来源:GsonValueMapper.java

示例7: fromInput

import java.lang.reflect.AnnotatedType; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T> T fromInput(Object graphQlInput, Type sourceType, AnnotatedType type) {
    if (graphQlInput.getClass() == type.getType()) {
        return (T) graphQlInput;
    }
    throw new IllegalArgumentException(MAPPING_ERROR);
}
 
开发者ID:leangen,项目名称:graphql-spqr,代码行数:9,代码来源:ScalarOnlyValueMapper.java

示例8: stubClassName

import java.lang.reflect.AnnotatedType; //导入方法依赖的package包/类
private String stubClassName(StubAmp stub)
{
  AnnotatedType api = stub.api();
  
  Type type = api.getType();

  TypeRef typeRef = TypeRef.of(type);
  
  return typeRef.rawClass().getSimpleName();
}
 
开发者ID:baratine,项目名称:baratine,代码行数:11,代码来源:ValidateProxy.java


注:本文中的java.lang.reflect.AnnotatedType.getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。