@Test public void testResolveAsyncType() { Index index = indexOf(); Type STRING_TYPE = Type.create(DotName.createSimple(String.class.getName()), Type.Kind.CLASS); Type target = ParameterizedType.create(DotName.createSimple(CompletableFuture.class.getName()), new Type[] { STRING_TYPE }, null); AnnotationScannerContext context = new AnnotationScannerContext(index, ClassLoaderUtil.getDefaultClassLoader(), emptyConfig()); Type result = SchemaFactory.resolveAsyncType(context, target, Collections.emptyList()); assertEquals(STRING_TYPE, result); }
static Type resolveAsyncType(final AnnotationScannerContext context, Type type, List<AnnotationScannerExtension> extensions) { if (type.kind() == Type.Kind.PARAMETERIZED_TYPE) { ParameterizedType pType = type.asParameterizedType(); if (pType.arguments().size() == 1 && (TypeUtil.isA(context, type, JDKConstants.COMPLETION_STAGE_TYPE) || TypeUtil.isA(context, type, MutinyConstants.UNI_TYPE))) { return pType.arguments().get(0); } } for (AnnotationScannerExtension extension : extensions) { Type asyncType = extension.resolveAsyncType(type); if (asyncType != null) return asyncType; } return type; }
SchemaFactory { static Type resolveAsyncType(final AnnotationScannerContext context, Type type, List<AnnotationScannerExtension> extensions) { if (type.kind() == Type.Kind.PARAMETERIZED_TYPE) { ParameterizedType pType = type.asParameterizedType(); if (pType.arguments().size() == 1 && (TypeUtil.isA(context, type, JDKConstants.COMPLETION_STAGE_TYPE) || TypeUtil.isA(context, type, MutinyConstants.UNI_TYPE))) { return pType.arguments().get(0); } } for (AnnotationScannerExtension extension : extensions) { Type asyncType = extension.resolveAsyncType(type); if (asyncType != null) return asyncType; } return type; } }
SchemaFactory { static Type resolveAsyncType(final AnnotationScannerContext context, Type type, List<AnnotationScannerExtension> extensions) { if (type.kind() == Type.Kind.PARAMETERIZED_TYPE) { ParameterizedType pType = type.asParameterizedType(); if (pType.arguments().size() == 1 && (TypeUtil.isA(context, type, JDKConstants.COMPLETION_STAGE_TYPE) || TypeUtil.isA(context, type, MutinyConstants.UNI_TYPE))) { return pType.arguments().get(0); } } for (AnnotationScannerExtension extension : extensions) { Type asyncType = extension.resolveAsyncType(type); if (asyncType != null) return asyncType; } return type; } private  SchemaFactory(); }
SchemaFactory { static Type resolveAsyncType(final AnnotationScannerContext context, Type type, List<AnnotationScannerExtension> extensions) { if (type.kind() == Type.Kind.PARAMETERIZED_TYPE) { ParameterizedType pType = type.asParameterizedType(); if (pType.arguments().size() == 1 && (TypeUtil.isA(context, type, JDKConstants.COMPLETION_STAGE_TYPE) || TypeUtil.isA(context, type, MutinyConstants.UNI_TYPE))) { return pType.arguments().get(0); } } for (AnnotationScannerExtension extension : extensions) { Type asyncType = extension.resolveAsyncType(type); if (asyncType != null) return asyncType; } return type; } private  SchemaFactory(); static Schema readSchema(final AnnotationScannerContext context, AnnotationValue value); static Schema readSchema(final AnnotationScannerContext context,
            Schema schema,
            AnnotationInstance annotation,
            ClassInfo clazz); static Schema readSchema(final AnnotationScannerContext context,
            Schema schema,
            AnnotationInstance annotation,
            Map<String, Object> defaults); static Schema typeToSchema(final AnnotationScannerContext context, Type type,
            List<AnnotationScannerExtension> extensions); static Schema enumToSchema(final AnnotationScannerContext context, Type enumType); static Schema schemaRegistration(final AnnotationScannerContext context, Type type, Schema schema); }
SchemaFactory { static Type resolveAsyncType(final AnnotationScannerContext context, Type type, List<AnnotationScannerExtension> extensions) { if (type.kind() == Type.Kind.PARAMETERIZED_TYPE) { ParameterizedType pType = type.asParameterizedType(); if (pType.arguments().size() == 1 && (TypeUtil.isA(context, type, JDKConstants.COMPLETION_STAGE_TYPE) || TypeUtil.isA(context, type, MutinyConstants.UNI_TYPE))) { return pType.arguments().get(0); } } for (AnnotationScannerExtension extension : extensions) { Type asyncType = extension.resolveAsyncType(type); if (asyncType != null) return asyncType; } return type; } private  SchemaFactory(); static Schema readSchema(final AnnotationScannerContext context, AnnotationValue value); static Schema readSchema(final AnnotationScannerContext context,
            Schema schema,
            AnnotationInstance annotation,
            ClassInfo clazz); static Schema readSchema(final AnnotationScannerContext context,
            Schema schema,
            AnnotationInstance annotation,
            Map<String, Object> defaults); static Schema typeToSchema(final AnnotationScannerContext context, Type type,
            List<AnnotationScannerExtension> extensions); static Schema enumToSchema(final AnnotationScannerContext context, Type enumType); static Schema schemaRegistration(final AnnotationScannerContext context, Type type, Schema schema);  }