Search in sources :

Example 1 with TypeResolver

use of com.fasterxml.classmate.TypeResolver in project thingsboard by thingsboard.

the class SwaggerConfiguration method thingsboardApi.

@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()));
}
Also used : TypeResolver(com.fasterxml.classmate.TypeResolver) Docket(springfox.documentation.spring.web.plugins.Docket) ResolvedType(com.fasterxml.classmate.ResolvedType) AlternateTypeRule(springfox.documentation.schema.AlternateTypeRule) Bean(org.springframework.context.annotation.Bean)

Example 2 with TypeResolver

use of com.fasterxml.classmate.TypeResolver in project dropwizard by dropwizard.

the class SelfValidatingValidatorTest method getMethod.

private ResolvedMethod getMethod(String name, Class<?>... params) {
    AnnotationConfiguration annotationConfiguration = new AnnotationConfiguration.StdConfiguration(AnnotationInclusion.INCLUDE_AND_INHERIT_IF_INHERITED);
    TypeResolver typeResolver = new TypeResolver();
    MemberResolver memberResolver = new MemberResolver(typeResolver);
    ResolvedTypeWithMembers annotatedType = memberResolver.resolve(typeResolver.resolve(InvalidExample.class), annotationConfiguration, null);
    for (ResolvedMethod m : annotatedType.getMemberMethods()) {
        if (hasSignature(m, name, params)) {
            return m;
        }
    }
    throw new IllegalStateException("Could not resolve method " + name + Arrays.toString(params) + " in " + InvalidExample.class);
}
Also used : ResolvedMethod(com.fasterxml.classmate.members.ResolvedMethod) TypeResolver(com.fasterxml.classmate.TypeResolver) AnnotationConfiguration(com.fasterxml.classmate.AnnotationConfiguration) MemberResolver(com.fasterxml.classmate.MemberResolver) ResolvedTypeWithMembers(com.fasterxml.classmate.ResolvedTypeWithMembers)

Aggregations

TypeResolver (com.fasterxml.classmate.TypeResolver)2 AnnotationConfiguration (com.fasterxml.classmate.AnnotationConfiguration)1 MemberResolver (com.fasterxml.classmate.MemberResolver)1 ResolvedType (com.fasterxml.classmate.ResolvedType)1 ResolvedTypeWithMembers (com.fasterxml.classmate.ResolvedTypeWithMembers)1 ResolvedMethod (com.fasterxml.classmate.members.ResolvedMethod)1 Bean (org.springframework.context.annotation.Bean)1 AlternateTypeRule (springfox.documentation.schema.AlternateTypeRule)1 Docket (springfox.documentation.spring.web.plugins.Docket)1