Package com.fasterxml.classmate

Examples of com.fasterxml.classmate.TypeResolver


        }
      } else {
        bindings.add(breadthFirstReplace(replaceableIterator, wildcardTypeBindings.getBoundType(index)));
      }
    }
    return new TypeResolver().resolve(wildcardType.getErasedType(), toArray(bindings, Type.class));
  }
View Full Code Here


   * @param original  the original
   * @param alternate the alternate
   * @return the alternate type rule
   */
  public static AlternateTypeRule newRule(Type original, Type alternate) {
    TypeResolver resolver = new TypeResolver();
    return new AlternateTypeRule(asResolved(resolver, original), asResolved(resolver, alternate));
  }
View Full Code Here

   * @param key   the class that represents a key
   * @param value the value
   * @return the alternate type rule
   */
  public static AlternateTypeRule newMapRule(Class<?> key, Class<?> value) {
    TypeResolver resolver = new TypeResolver();
    return new AlternateTypeRule(resolver.resolve(Map.class, key, value),
            resolver.resolve(List.class, resolver.resolve(Entry.class, key, value)));
  }
View Full Code Here

@Configuration
@ComponentScan(basePackages = {"com.mangofactory.swagger.models"})
public class SwaggerModelsConfiguration {
  @Bean
  public TypeResolver typeResolver() {
    return new TypeResolver();
  }
View Full Code Here

  public static <T extends Collection> ResolvedType elementType(ResolvedType container, Class<T> collectionType) {
    List<ResolvedType> resolvedTypes = container.typeParametersFor(collectionType);
    if (resolvedTypes.size() == 1) {
      return resolvedTypes.get(0);
    }
    return new TypeResolver().resolve(Object.class);
  }
View Full Code Here

    return new ModelContext(context, input);
  }

  public boolean hasSeenBefore(ResolvedType resolvedType) {
    return seenTypes.contains(resolvedType)
            || seenTypes.contains(asResolved(new TypeResolver(), resolvedType.getErasedType())) // DK TODO : fix
            // alternate types
            || parentHasSeenBefore(resolvedType);
  }
View Full Code Here

public class TypeResolutionHelper {

  private final TypeResolver typeResolver;

  public TypeResolutionHelper() {
    typeResolver = new TypeResolver();
  }
View Full Code Here

   * @param type the type to be handled
   *
   * @return the handler for the given type or {@code null} if no matching handler was found
   */
  private ValidatedValueUnwrapper<?> getValidatedValueHandler(Type type) {
    TypeResolver typeResolver = typeResolutionHelper.getTypeResolver();

    for ( ValidatedValueUnwrapper<?> handler : validatedValueHandlers ) {
      ResolvedType handlerType = typeResolver.resolve( handler.getClass() );
      List<ResolvedType> typeParameters = handlerType.typeParametersFor( ValidatedValueUnwrapper.class );

      if ( TypeHelper.isAssignable( typeParameters.get( 0 ).getErasedType(), type ) ) {
        return handler;
      }
View Full Code Here

   * @param type the type to be handled
   *
   * @return the handler for the given type or {@code null} if no matching handler was found
   */
  private ValidatedValueUnwrapper<?> getValidatedValueHandler(Type type) {
    TypeResolver typeResolver = typeResolutionHelper.getTypeResolver();

    for ( ValidatedValueUnwrapper<?> handler : validatedValueHandlers ) {
      ResolvedType handlerType = typeResolver.resolve( handler.getClass() );
      List<ResolvedType> typeParameters = handlerType.typeParametersFor( ValidatedValueUnwrapper.class );

      if ( TypeHelper.isAssignable( typeParameters.get( 0 ).getErasedType(), type ) ) {
        return handler;
      }
View Full Code Here

    }

    protected List<String> getFieldNames(Class<?> type)
    {
        List<String> fields = new ArrayList<String>();
        TypeResolver typeResolver = new TypeResolver();
        ResolvedType resolvedType = typeResolver.resolve(type);

        MemberResolver memberResolver = new MemberResolver(typeResolver);
        ResolvedTypeWithMembers typeWithMembers = memberResolver.resolve(resolvedType, null, null);

        for (ResolvedField field : typeWithMembers.getMemberFields())
View Full Code Here

TOP

Related Classes of com.fasterxml.classmate.TypeResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.