本文整理汇总了Java中com.fasterxml.classmate.TypeResolver.resolve方法的典型用法代码示例。如果您正苦于以下问题:Java TypeResolver.resolve方法的具体用法?Java TypeResolver.resolve怎么用?Java TypeResolver.resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.classmate.TypeResolver
的用法示例。
在下文中一共展示了TypeResolver.resolve方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: thingsboardApi
import com.fasterxml.classmate.TypeResolver; //导入方法依赖的package包/类
@Bean
public Docket thingsboardApi() {
TypeResolver typeResolver = new TypeResolver();
final ResolvedType jsonNodeType =
typeResolver.resolve(
JsonNode.class);
final ResolvedType stringType =
typeResolver.resolve(
String.class);
return new Docket(DocumentationType.SWAGGER_2)
.groupName("iotp")
.apiInfo(apiInfo())
.alternateTypeRules(
new AlternateTypeRule(
jsonNodeType,
stringType))
.select()
.paths(apiPaths())
.build()
.securitySchemes(newArrayList(jwtTokenKey()))
.securityContexts(newArrayList(securityContext()));
}
示例2: NavigableIndex
import com.fasterxml.classmate.TypeResolver; //导入方法依赖的package包/类
@SneakyThrows
protected NavigableIndex(DataSource dataSource, Attribute<O, A> attribute) {
super(attribute instanceof SerializableComparableAttribute ? ((SerializableComparableAttribute) attribute)
.getAttribute() : attribute, new HashSet<Class<?
extends Query>>
() {{
add(Equal.class);
add(LessThan.class);
add(GreaterThan.class);
add(Between.class);
add(Has.class);
add(Min.class);
add(Max.class);
}});
comparableAttribute = attribute;
this.dataSource = dataSource;
layout = Layout.forClass(comparableAttribute.getEffectiveObjectType());
TypeResolver typeResolver = new TypeResolver();
ResolvedType resolvedType = typeResolver.resolve(comparableAttribute.getAttributeType());
attributeTypeHandler = TypeHandler.lookup(resolvedType);
init();
}
示例3: EqualityIndex
import com.fasterxml.classmate.TypeResolver; //导入方法依赖的package包/类
@SneakyThrows
protected EqualityIndex(DataSource dataSource, Attribute<O, A> attribute, boolean unique) {
super(attribute, new HashSet<Class<? extends Query>>() {{
add(Equal.class);
add(Has.class);
}});
this.dataSource = dataSource;
this.unique = unique;
layout = Layout.forClass(attribute.getEffectiveObjectType());
TypeResolver typeResolver = new TypeResolver();
ResolvedType resolvedType;
if (attribute instanceof ReflectableAttribute) {
resolvedType = typeResolver.resolve(((ReflectableAttribute) attribute).getAttributeReflectedType());
} else {
resolvedType = typeResolver.resolve(attribute.getAttributeType());
}
attributeTypeHandler = TypeHandler.lookup(resolvedType);
init();
}
示例4: thingsboardApi
import com.fasterxml.classmate.TypeResolver; //导入方法依赖的package包/类
@Bean
public Docket thingsboardApi() {
TypeResolver typeResolver = new TypeResolver();
final ResolvedType jsonNodeType =
typeResolver.resolve(
JsonNode.class);
final ResolvedType stringType =
typeResolver.resolve(
String.class);
return new Docket(DocumentationType.SWAGGER_2)
.groupName("thingsboard")
.apiInfo(apiInfo())
.alternateTypeRules(
new AlternateTypeRule(
jsonNodeType,
stringType))
.select()
.paths(apiPaths())
.build()
.securitySchemes(newArrayList(jwtTokenKey()))
.securityContexts(newArrayList(securityContext()));
}
示例5: generics
import com.fasterxml.classmate.TypeResolver; //导入方法依赖的package包/类
@Test
@SneakyThrows
public void generics() {
SimpleAttribute<Car, List<String>> FEATURES_LIST = new SimpleAttribute<Car, List<String>>("features") {
@SneakyThrows
@Override public Type getAttributeReflectedType() {
return AbstractAttributeIndexTest.class.getField("list").getGenericType();
}
@Override
public List<String> getValue(Car car, QueryOptions queryOptions) {
return car.getFeatures();
}
};
AttributeIndex index = new AttributeIndex<>(FEATURES_LIST, new HashSet<Class<? extends Query>>() {{}});
list = Arrays.asList("Hello");
TypeResolver typeResolver = new TypeResolver();
ResolvedType klassType = typeResolver.resolve(getClass().getField("list").getGenericType());
TypeHandler listTypeHandler = TypeHandler.lookup(klassType);
ByteBuffer buffer = ByteBuffer.allocate(index.attributeSerializer.size(listTypeHandler, list));
index.attributeSerializer.serialize(listTypeHandler, list, buffer);
buffer.rewind();
List<String> deserialized = (List<String>) index.attributeDeserializer.deserialize(listTypeHandler, buffer);
assertEquals(deserialized.get(0), list.get(0));
}
示例6: enrich
import com.fasterxml.classmate.TypeResolver; //导入方法依赖的package包/类
public void enrich(ApiObjectDoc model) throws ClassNotFoundException {
if (!model.isPrimitiv()) {
TypeResolver typeResolver = new TypeResolver();
ResolvedType resolvedType = typeResolver.resolve(Class.forName(model.getModelClass(), true, Thread.currentThread()
.getContextClassLoader()));
SerializationConfig serializationConfig = objectMapper.getSerializationConfig();
BeanDescription beanDescription = serializationConfig.introspect(TypeFactory.defaultInstance()
.constructType(resolvedType.getErasedType()));
MemberResolver memberResolver = new MemberResolver(typeResolver);
ResolvedTypeWithMembers resolvedMemberWithMembers;
try {
resolvedMemberWithMembers = memberResolver.resolve(resolvedType, null, null);
}
catch (ArrayIndexOutOfBoundsException aioobex) {
// TODO this is to avoid an AIOOBEX in memberResolver, should this get fixed upstream?
return;
}
Map<String, BeanPropertyDefinition> propertyLookup = uniqueIndex(beanDescription.findProperties(), beanPropertyByInternalName());
ClassDescription classDescription = apiDescriptionFinder.getClassDescription(model.getModelClass());
for (ResolvedField childField : resolvedMemberWithMembers.getMemberFields()) {
if (propertyLookup.containsKey(childField.getName())) {
BeanPropertyDefinition propertyDefinition = propertyLookup.get(childField.getName());
AnnotatedMember member = propertyDefinition.getField();
if (member != null && member.getMember() != null && Field.class.isAssignableFrom(member.getMember().getClass())) {
ApiObjectFieldDoc apiField = new ApiObjectFieldDoc();
apiField.setName(propertyDefinition.getName());
apiField.setType(propertyDefinition.getField().getRawType().getSimpleName());
apiField.setDescription(apiDescriptionFinder.getFieldDescription(classDescription, propertyDefinition.getName()));
apiField.setAnnotations(apiDescriptionFinder.getFieldAnnotations(classDescription, propertyDefinition.getName()));
if (Collection.class.isAssignableFrom(propertyDefinition.getField().getRawType())) {
apiField.setMultiple(true);
if (propertyDefinition.getField().getGenericType() instanceof ParameterizedType) {
Class<?> c = (Class<?>) ((ParameterizedType) propertyDefinition.getField().getGenericType()).getActualTypeArguments()[0];
apiField.setType(c.getSimpleName());
}
}
model.addField(apiField);
}
}
}
}
}
示例7: getMessageRule
import com.fasterxml.classmate.TypeResolver; //导入方法依赖的package包/类
private AlternateTypeRule getMessageRule(final TypeResolver resolver) {
return new AlternateTypeRule(resolver.resolve(Message.class), this.getContreteMessageResolvedType(resolver));
}
示例8: getMessageListResolvedType
import com.fasterxml.classmate.TypeResolver; //导入方法依赖的package包/类
private ResolvedType getMessageListResolvedType(final TypeResolver resolver) {
return resolver.resolve(List.class, Message.class);
}
示例9: getContreteMessageResolvedType
import com.fasterxml.classmate.TypeResolver; //导入方法依赖的package包/类
private ResolvedType getContreteMessageResolvedType(final TypeResolver resolver) {
return resolver.resolve(this.getResponseStrategy().getConcreteMessageClass());
}
示例10: OperationPageableParameterReader
import com.fasterxml.classmate.TypeResolver; //导入方法依赖的package包/类
@Autowired
public OperationPageableParameterReader(TypeNameExtractor nameExtractor, TypeResolver resolver) {
this.nameExtractor = nameExtractor;
this.resolver = resolver;
this.pageableType = resolver.resolve(Pageable.class);
}
开发者ID:MaritimeConnectivityPlatform,项目名称:IdentityRegistry,代码行数:7,代码来源:OperationPageableParameterReader.java
示例11: PageableParameterBuilderPlugin
import com.fasterxml.classmate.TypeResolver; //导入方法依赖的package包/类
public PageableParameterBuilderPlugin(TypeNameExtractor nameExtractor, TypeResolver resolver) {
this.nameExtractor = nameExtractor;
this.resolver = resolver;
this.pageableType = resolver.resolve(Pageable.class);
}
示例12: resolveSingleTypeParameter
import com.fasterxml.classmate.TypeResolver; //导入方法依赖的package包/类
/**
* Resolves the single type parameter of the given target class, using the given sub-type.
*/
private static Class<?> resolveSingleTypeParameter(TypeResolver typeResolver, Type subType, Class<?> target) {
ResolvedType resolvedType = typeResolver.resolve( subType );
return resolvedType.typeParametersFor( target ).get( 0 ).getErasedType();
}