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


Java TypeResolver类代码示例

本文整理汇总了Java中com.fasterxml.classmate.TypeResolver的典型用法代码示例。如果您正苦于以下问题:Java TypeResolver类的具体用法?Java TypeResolver怎么用?Java TypeResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TypeResolver类属于com.fasterxml.classmate包,在下文中一共展示了TypeResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()));
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:24,代码来源:SwaggerConfiguration.java

示例2: createIndoorRestApiDocket

import com.fasterxml.classmate.TypeResolver; //导入依赖的package包/类
/**
 * Creates for the dynamic documentation necessary REST API Docket.
 * @param typeResolver The type resolver. Must not be <code>null</code>.
 * @return The requested REST API Docket.
 */
public static Docket createIndoorRestApiDocket(TypeResolver typeResolver) {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(Predicates.not(PathSelectors.regex(EXCLUDE_ERROR_PATH_REGEX)))
            .build()
            .pathMapping(ROOT_PATH)
            .directModelSubstitute(LocalDate.class,
                    String.class)
            .genericModelSubstitutes(ResponseEntity.class)
            .alternateTypeRules(
                    newRule(typeResolver.resolve(DeferredResult.class,
                            typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
                            typeResolver.resolve(WildcardType.class)))
            .useDefaultResponseMessages(false)
            .enableUrlTemplating(false)
            .tags(new Tag(TAG_NAME, TAG_DESCRIPTION)).apiInfo(apiInfo());
}
 
开发者ID:ProjectIndoor,项目名称:projectindoorweb,代码行数:24,代码来源:IndoorApiDescriptionHelper.java

示例3: 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();
}
 
开发者ID:eventsourcing,项目名称:es4j,代码行数:23,代码来源:NavigableIndex.java

示例4: 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();
}
 
开发者ID:eventsourcing,项目名称:es4j,代码行数:20,代码来源:EqualityIndex.java

示例5: 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()));
}
 
开发者ID:thingsboard,项目名称:thingsboard,代码行数:24,代码来源:SwaggerConfiguration.java

示例6: setup

import com.fasterxml.classmate.TypeResolver; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    MockitoAnnotations.initMocks(this);

    Method method = this.getClass().getMethod("test", new Class<?>[] { Pageable.class, Integer.class });
    RequestHandler handler = new WebMvcRequestHandler(null, new HandlerMethod(this, method));
    DocumentationContext docContext = mock(DocumentationContext.class);
    RequestMappingContext reqContext = new RequestMappingContext(docContext, handler);
    builder = spy(new OperationBuilder(null));
    context = new OperationContext(builder, RequestMethod.GET, reqContext, 0);

    resolver = new TypeResolver();
    List<TypeNameProviderPlugin> plugins = new LinkedList<>();
    extractor = new TypeNameExtractor(resolver, SimplePluginRegistry.create(plugins));
    plugin = new PageableParameterBuilderPlugin(extractor, resolver);
}
 
开发者ID:jhipster,项目名称:jhipster,代码行数:17,代码来源:PageableParameterBuilderPluginTest.java

示例7: bpaTestapplicationApi

import com.fasterxml.classmate.TypeResolver; //导入依赖的package包/类
@Bean
public Docket bpaTestapplicationApi(final TypeResolver typeResolver) {

  return new Docket(DocumentationType.SWAGGER_2)
    .select()
    .apis(RequestHandlerSelectors.any())
    .paths(Predicates.not(PathSelectors.regex("/error.*")))
    .build()
    .pathMapping("/")
    .apiInfo(new ApiInfoBuilder()
      .title("Book Order Process")
      .version("1.0-SNAPSHOT")
      .build());
}
 
开发者ID:holisticon,项目名称:holunda,代码行数:15,代码来源:SwaggerConfiguration.java

示例8: Layout

import com.fasterxml.classmate.TypeResolver; //导入依赖的package包/类
private Layout(Class<T> klass)
        throws IntrospectionException, NoSuchAlgorithmException, IllegalAccessException,
               TypeHandler.TypeHandlerException {
    typeResolver = new TypeResolver();
    methodHandles = MethodHandles.lookup();

    layoutClass = klass;
    properties = new ArrayList<>();
    constructorProperties = new ArrayList<>();

    ClassAnalyzer.Constructor<T> analyzerConstructor = findLayoutConstructor(layoutClass);
    constructor = analyzerConstructor.getConstructor();
    deriveProperties(layoutClass, analyzerConstructor, false);

    // Prepare the hash
    MessageDigest digest = MessageDigest.getInstance(DIGEST_ALGORITHM);

    name = klass.isAnnotationPresent(LayoutName.class) ? klass.getAnnotation(LayoutName.class)
                                                              .value() : klass.getName();

    // It is important to include class name into the hash as there could be situations
    // when POJOs have indistinguishable layouts, and therefore it is impossible to
    // guarantee that we'd pick the right class
    digest.update(name.getBytes());

    for (Property<T> property : properties) {
        digest.update(property.getName().getBytes());
        digest.update(property.getTypeHandler().getFingerprint());
    }

    this.hash = digest.digest();
}
 
开发者ID:eventsourcing,项目名称:es4j,代码行数:33,代码来源:Layout.java

示例9: OptionalTypeHandler

import com.fasterxml.classmate.TypeResolver; //导入依赖的package包/类
public OptionalTypeHandler(List<ResolvedType> typeParameters) throws TypeHandlerException {
    if (typeParameters.size() != 1) {
        throw new IllegalArgumentException("Optional type parameters should be specified");
    }
    ResolvedType resolvedType = new TypeResolver().resolve(typeParameters.get(0));
    wrappedHandler = TypeHandler.lookup(resolvedType);
}
 
开发者ID:eventsourcing,项目名称:es4j,代码行数:8,代码来源:OptionalTypeHandler.java

示例10: ListTypeHandler

import com.fasterxml.classmate.TypeResolver; //导入依赖的package包/类
public ListTypeHandler(List<ResolvedType> typeParameters) throws TypeHandlerException {
    if (typeParameters.size() != 1) {
        throw new IllegalArgumentException("List type parameter should be specified");
    }
    ResolvedType resolvedType = new TypeResolver().resolve(typeParameters.get(0));
    wrappedHandler = TypeHandler.lookup(resolvedType);
}
 
开发者ID:eventsourcing,项目名称:es4j,代码行数:8,代码来源:ListTypeHandler.java

示例11: MapTypeHandler

import com.fasterxml.classmate.TypeResolver; //导入依赖的package包/类
public MapTypeHandler(List<ResolvedType> typeParameters) throws TypeHandlerException {
    if (typeParameters.size() != 2) {
        throw new IllegalArgumentException("Map type parameters should be specified");
    }
    ResolvedType resolvedKeyType = new TypeResolver().resolve(typeParameters.get(0));
    wrappedKeyHandler = TypeHandler.lookup(resolvedKeyType);
    ResolvedType resolvedValueType = new TypeResolver().resolve(typeParameters.get(1));
    wrappedValueHandler = TypeHandler.lookup(resolvedValueType);
}
 
开发者ID:eventsourcing,项目名称:es4j,代码行数:10,代码来源:MapTypeHandler.java

示例12: fingerprintShape

import com.fasterxml.classmate.TypeResolver; //导入依赖的package包/类
@Test @SneakyThrows
public void fingerprintShape() {
    TypeHandler typeHandlerA = TypeHandler.lookup(new TypeResolver().resolve(A.class));
    TypeHandler typeHandlerA1 = TypeHandler.lookup(new TypeResolver().resolve(A1.class));
    TypeHandler typeHandlerA2 = TypeHandler.lookup(new TypeResolver().resolve(A2.class));
    assertTrue(Arrays.equals(typeHandlerA.getFingerprint(), typeHandlerA1.getFingerprint()));
    assertFalse(Arrays.equals(typeHandlerA.getFingerprint(), typeHandlerA2.getFingerprint()));
}
 
开发者ID:eventsourcing,项目名称:es4j,代码行数:9,代码来源:EnumTypeHandlerTest.java

示例13: AbstractAttributeIndex

import com.fasterxml.classmate.TypeResolver; //导入依赖的package包/类
/**
 * Protected constructor, called by subclasses.
 *
 * @param attribute        The attribute on which the index will be built
 * @param supportedQueries The set of {@link Query} types which the subclass implementation supports
 */
@SneakyThrows
protected AbstractAttributeIndex(Attribute<O, A> attribute, Set<Class<? extends Query>>
        supportedQueries) {
    super(attribute, supportedQueries);

    Type t;
    if (attribute instanceof ReflectableAttribute) {
        t = ((ReflectableAttribute) attribute).getAttributeReflectedType();
    } else {
        t = attribute.getAttributeType();
    }

    ResolvedType attributeType = new TypeResolver().resolve(t);

    attrTypeHandler = TypeHandler.lookup(attributeType);
    attributeSerializer = serialization.getSerializer(attrTypeHandler);
    attributeDeserializer = serialization.getDeserializer(attrTypeHandler);

    ResolvedType objectType = new TypeResolver().resolve(attribute.getEffectiveObjectType());
    ObjectTypeHandler objectTypeHandler = (ObjectTypeHandler) TypeHandler.lookup(objectType);
    if (!(objectTypeHandler instanceof ObjectTypeHandler)) {
        throw new RuntimeException("Index " + attribute.getAttributeName() +
                                           " is not an object, but " + objectType.getBriefDescription());
    } else {
        objectSerializer = serialization.getSerializer(objectTypeHandler.getWrappedClass());
        objectDeserializer = serialization.getDeserializer(objectTypeHandler.getWrappedClass());
    }
}
 
开发者ID:eventsourcing,项目名称:es4j,代码行数:35,代码来源:AbstractAttributeIndex.java

示例14: 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));
}
 
开发者ID:eventsourcing,项目名称:es4j,代码行数:29,代码来源:AbstractAttributeIndexTest.java

示例15: testPageableParameterBuilderPlugin

import com.fasterxml.classmate.TypeResolver; //导入依赖的package包/类
@Test
public void testPageableParameterBuilderPlugin() {
    TypeResolver resolver = new TypeResolver();
    List<TypeNameProviderPlugin> plugins = new LinkedList<>();
    TypeNameExtractor extractor = new TypeNameExtractor(resolver, SimplePluginRegistry.create(plugins));
    PageableParameterBuilderPlugin plugin = config.pageableParameterBuilderPlugin(extractor, resolver);
    assertThat(plugin.getResolver()).isEqualTo(resolver);
    assertThat(plugin.getNameExtractor()).isEqualTo(extractor);
}
 
开发者ID:jhipster,项目名称:jhipster,代码行数:10,代码来源:SwaggerConfigurationTest.java


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