本文整理汇总了Java中com.fasterxml.classmate.ResolvedType类的典型用法代码示例。如果您正苦于以下问题:Java ResolvedType类的具体用法?Java ResolvedType怎么用?Java ResolvedType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResolvedType类属于com.fasterxml.classmate包,在下文中一共展示了ResolvedType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: thingsboardApi
import com.fasterxml.classmate.ResolvedType; //导入依赖的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: ConstructorParameterModelProperty
import com.fasterxml.classmate.ResolvedType; //导入依赖的package包/类
/**
* Creates a ConstructorParameterModelProperty which provides a ModelProperty
* for constructor parameters.
*
* @param resolvedParameterType the parameter type
* @param alternateTypeProvider provider for resolving alternatives for the given param type
* @param annotationMap map of annotations for the given parameter. it must contain a @JsonProperty annotation.
*/
public ConstructorParameterModelProperty(
ResolvedType resolvedParameterType,
AlternateTypeProvider alternateTypeProvider,
AnnotationMap annotationMap) {
this.resolvedParameterType = alternateTypeProvider.alternateFor(resolvedParameterType);
if (this.resolvedParameterType == null) {
this.resolvedParameterType = resolvedParameterType;
}
setJsonProperty(annotationMap.get(JsonProperty.class));
setTypeName();
setAllowableValues();
setQualifiedTypeName();
}
示例3: inputParam
import com.fasterxml.classmate.ResolvedType; //导入依赖的package包/类
private Function<ResolvedType, ? extends ModelReference>
createModelRefFactory(ParameterContext context) {
ModelContext modelContext = inputParam(context.resolvedMethodParameter().getParameterType(),
context.getDocumentationType(),
context.getAlternateTypeProvider(),
context.getGenericNamingStrategy(),
context.getIgnorableParameterTypes());
return modelRefFactory(modelContext, nameExtractor);
}
示例4: apply
import com.fasterxml.classmate.ResolvedType; //导入依赖的package包/类
@Override
public void apply(ParameterContext context) {
ResolvedMethodParameter parameter = context.resolvedMethodParameter();
Class<?> type = parameter.getParameterType().getErasedType();
if (type != null && Pageable.class.isAssignableFrom(type)) {
Function<ResolvedType, ? extends ModelReference> factory =
createModelRefFactory(context);
ModelReference intModel = factory.apply(resolver.resolve(Integer.TYPE));
ModelReference stringModel = factory.apply(resolver.resolve(List.class, String.class));
List<Parameter> parameters = newArrayList(
context.parameterBuilder()
.parameterType("query").name("page").modelRef(intModel)
.description("Page number of the requested page")
.build(),
context.parameterBuilder()
.parameterType("query").name("size").modelRef(intModel)
.description("Size of a page")
.build(),
context.parameterBuilder()
.parameterType("query").name("sort").modelRef(stringModel).allowMultiple(true)
.description("Sorting criteria in the format: property(,asc|desc). "
+ "Default sort order is ascending. "
+ "Multiple sort criteria are supported.")
.build());
context.getOperationContext().operationBuilder().parameters(parameters);
}
}
示例5: resolveAllTypes
import com.fasterxml.classmate.ResolvedType; //导入依赖的package包/类
@Override
public void resolveAllTypes(String className) {
// the resolved type for the top level class in the hierarchy
Class<?> clazz = classLoaderService.getValue().classForName( className );
ResolvedType resolvedType = typeResolver.resolve( clazz );
while ( resolvedType != null ) {
// todo - check whether there is already something in the map
resolvedTypeCache.put( clazz, resolvedType );
resolvedType = resolvedType.getParentClass();
if ( resolvedType != null ) {
clazz = resolvedType.getErasedType();
}
}
}
示例6: inputParam
import com.fasterxml.classmate.ResolvedType; //导入依赖的package包/类
private Function<ResolvedType, ? extends ModelReference>
createModelRefFactory(ParameterContext context) {
ModelContext modelContext = inputParam(context.methodParameter().getParameterType(),
context.getDocumentationType(),
context.getAlternateTypeProvider(),
context.getGenericNamingStrategy(),
context.getIgnorableParameterTypes());
return modelRefFactory(modelContext, nameExtractor);
}
示例7: apply
import com.fasterxml.classmate.ResolvedType; //导入依赖的package包/类
@Override
public void apply(ParameterContext context) {
MethodParameter parameter = context.methodParameter();
Class<?> type = parameter.getParameterType();
if (type != null && Pageable.class.isAssignableFrom(type)) {
Function<ResolvedType, ? extends ModelReference> factory =
createModelRefFactory(context);
ModelReference intModel = factory.apply(resolver.resolve(Integer.TYPE));
ModelReference stringModel = factory.apply(resolver.resolve(List.class, String.class));
List<Parameter> parameters = newArrayList(
context.parameterBuilder()
.parameterType("query").name("page").modelRef(intModel)
.description("Page number of the requested page")
.build(),
context.parameterBuilder()
.parameterType("query").name("size").modelRef(intModel)
.description("Size of a page")
.build(),
context.parameterBuilder()
.parameterType("query").name("sort").modelRef(stringModel).allowMultiple(true)
.description("Sorting criteria in the format: property(,asc|desc). "
+ "Default sort order is ascending. "
+ "Multiple sort criteria are supported.")
.build());
context.getOperationContext().operationBuilder().parameters(parameters);
}
}
示例8: NavigableIndex
import com.fasterxml.classmate.ResolvedType; //导入依赖的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();
}
示例9: EqualityIndex
import com.fasterxml.classmate.ResolvedType; //导入依赖的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();
}
示例10: createModelRefFactory
import com.fasterxml.classmate.ResolvedType; //导入依赖的package包/类
private Function<ResolvedType, ? extends ModelReference> createModelRefFactory(ParameterContext context) {
ModelContext modelContext = inputParam(
context.getGroupName(),
context.resolvedMethodParameter().getParameterType(),
context.getDocumentationType(),
context.getAlternateTypeProvider(),
context.getGenericNamingStrategy(),
context.getIgnorableParameterTypes());
return ResolvedTypes.modelRefFactory(modelContext, nameExtractor);
}
开发者ID:MaritimeConnectivityPlatform,项目名称:IdentityRegistry,代码行数:11,代码来源:OperationPageableParameterReader.java
示例11: thingsboardApi
import com.fasterxml.classmate.ResolvedType; //导入依赖的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()));
}
示例12: createModelRefFactory
import com.fasterxml.classmate.ResolvedType; //导入依赖的package包/类
Function<ResolvedType, ? extends ModelReference> createModelRefFactory(ParameterContext context) {
ModelContext modelContext = inputParam(
context.getGroupName(),
context.resolvedMethodParameter().getParameterType(),
context.getDocumentationType(),
context.getAlternateTypeProvider(),
context.getGenericNamingStrategy(),
context.getIgnorableParameterTypes());
return modelRefFactory(modelContext, nameExtractor);
}
示例13: getModelProperties
import com.fasterxml.classmate.ResolvedType; //导入依赖的package包/类
/**
* Creates a collection of ConstructorParameterModelProperty objects from the arguments of the given ResolvedConstructor.
* Only args annotated with @JsonProperty are included. Scala Case Classes are a special case and do not require the annotation.
*
* @param resolvedConstructor the constructor to get
* @param alternateTypeProvider for resolving alternative types for the found arguments
* @return the collection of ConstructorParameterModelProperty objects
*/
public static ImmutableList<ConstructorParameterModelProperty> getModelProperties(ResolvedConstructor resolvedConstructor, AlternateTypeProvider alternateTypeProvider){
Builder<ConstructorParameterModelProperty> listBuilder = new Builder<>();
if(resolvedConstructor.getRawMember().getAnnotation(JsonCreator.class) != null || scala.Product.class.isAssignableFrom(resolvedConstructor.getDeclaringType().getErasedType())){
//constructor for normal classes must be annotated with @JsonCreator. Scala Case Classes are a special case
for(int i=0;i<resolvedConstructor.getArgumentCount();i++){
AnnotationMap annotationMap = annotationMap(resolvedConstructor.getRawMember().getParameterAnnotations()[i]);
ResolvedType parameterType = resolvedConstructor.getArgumentType(i);
if(annotationMap.get(JsonProperty.class) != null){
listBuilder.add(new ConstructorParameterModelProperty(parameterType, alternateTypeProvider, annotationMap));
}
}
}
return listBuilder.build();
}
示例14: constructorsIn
import com.fasterxml.classmate.ResolvedType; //导入依赖的package包/类
/**
* Finds the constructors in the given type
*
* @param resolvedType the type to search
*/
public com.google.common.collect.ImmutableList<ResolvedConstructor> constructorsIn(ResolvedType resolvedType) {
MemberResolver resolver = new MemberResolver(typeResolver);
resolver.setIncludeLangObject(false);
if (resolvedType.getErasedType() == Object.class) {
return ImmutableList.of();
}
ResolvedTypeWithMembers typeWithMembers = resolver.resolve(resolvedType, null, null);
return FluentIterable
.from(newArrayList(typeWithMembers.getConstructors())).toList();
}
示例15: propertiesForSerialization
import com.fasterxml.classmate.ResolvedType; //导入依赖的package包/类
@Override
public Iterable<? extends ModelProperty> propertiesForSerialization(ResolvedType type) {
List<ModelProperty> serializableProperties = newArrayList();
Iterables.addAll(serializableProperties,defaultModelPropertiesProvider.propertiesForSerialization(type));
if(type.isInstanceOf(scala.Product.class)){
//special case for Scala Case Classes. fields are defined in the constructor
addConstructors(serializableProperties, type);
}
return serializableProperties;
}