本文整理汇总了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();
}
示例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());
}
示例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;
}
示例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());
}
}
示例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;
}
}
示例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());
}
示例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);
}
示例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();
}