Java Code Examples for org.jboss.jandex.Type

The following examples show how to use org.jboss.jandex.Type. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: quarkus   Source File: Types.java    License: Apache License 2.0 6 votes vote down vote up
static Type resolveTypeParam(Type typeParam, Map<TypeVariable, Type> resolvedTypeParameters, IndexView index) {
    if (typeParam.kind() == Kind.TYPE_VARIABLE) {
        return resolvedTypeParameters.getOrDefault(typeParam, typeParam);
    } else if (typeParam.kind() == Kind.PARAMETERIZED_TYPE) {
        ParameterizedType parameterizedType = typeParam.asParameterizedType();
        ClassInfo classInfo = getClassByName(index, parameterizedType.name());
        if (classInfo != null) {
            List<TypeVariable> typeParameters = classInfo.typeParameters();
            List<Type> arguments = parameterizedType.arguments();
            Map<TypeVariable, Type> resolvedMap = buildResolvedMap(arguments, typeParameters,
                    resolvedTypeParameters, index);
            Type[] typeParams = new Type[typeParameters.size()];
            for (int i = 0; i < typeParameters.size(); i++) {
                typeParams[i] = resolveTypeParam(arguments.get(i), resolvedMap, index);
            }
            return ParameterizedType.create(parameterizedType.name(), typeParams, null);
        }
    }
    return typeParam;
}
 
Example 2
private Schema readSchemaAnnotatedField(String propertyKey, AnnotationInstance annotation, Type postProcessedField) {
    DataObjectLogging.log.processingFieldAnnotation(annotation, propertyKey);

    // If "required" attribute is on field. It should be applied to the *parent* schema.
    // Required is false by default.
    if (JandexUtil.booleanValueWithDefault(annotation, SchemaConstant.PROP_REQUIRED)) {
        parentPathEntry.getSchema().addRequired(propertyKey);
    }

    // TypeFormat pair contains mappings for Java <-> OAS types and formats.
    // Provide inferred type and format if relevant.
    Map<String, Object> defaults;

    if (JandexUtil.isArraySchema(annotation)) {
        defaults = Collections.emptyMap();
    } else {
        defaults = TypeUtil.getTypeAttributes(postProcessedField);
    }

    // readSchema *may* replace the existing schema, so we must assign.
    return SchemaFactory.readSchema(index, new SchemaImpl(), annotation, defaults);
}
 
Example 3
Source Project: quarkus   Source File: Types.java    License: Apache License 2.0 6 votes vote down vote up
static Set<Type> restrictBeanTypes(Set<Type> types, Collection<AnnotationInstance> annotations) {
    AnnotationInstance typed = annotations.stream().filter(a -> a.name().equals(DotNames.TYPED))
            .findFirst().orElse(null);
    if (typed != null) {
        AnnotationValue typedValue = typed.value();
        if (typedValue == null) {
            types.clear();
            types.add(OBJECT_TYPE);
        } else {
            Set<DotName> typedClasses = new HashSet<>();
            for (Type type : typedValue.asClassArray()) {
                typedClasses.add(type.name());
            }
            for (Iterator<Type> iterator = types.iterator(); iterator.hasNext();) {
                Type nextType = iterator.next();
                if (!typedClasses.contains(nextType.name()) && !DotNames.OBJECT.equals(nextType.name())) {
                    iterator.remove();
                }
            }
        }
    }
    return types;
}
 
Example 4
Source Project: quarkus   Source File: AsmUtil.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns the Java bytecode signature of a given Jandex MethodInfo using the given type argument mappings.
 * For example, given this method:
 * 
 * <pre>
 * {@code
 * public class Foo<T> {
 *  public <R> List<R> method(int a, T t){...} 
 * }
 * }
 * </pre>
 * 
 * This will return <tt>&lt;R:Ljava/lang/Object;>(ILjava/lang/Integer;)Ljava/util/List&lt;TR;>;</tt> if
 * your {@code typeArgMapper} contains {@code T=Ljava/lang/Integer;}.
 * 
 * @param method the method you want the signature for.
 * @param typeArgMapper a mapping between type argument names and their bytecode signature.
 * @return a bytecode signature for that method.
 */
public static String getSignature(MethodInfo method, Function<String, String> typeArgMapper) {
    List<Type> parameters = method.parameters();

    StringBuilder signature = new StringBuilder("");
    for (TypeVariable typeVariable : method.typeParameters()) {
        if (signature.length() == 0)
            signature.append("<");
        else
            signature.append(",");
        signature.append(typeVariable.identifier()).append(":");
        // FIXME: only use the first bound
        toSignature(signature, typeVariable.bounds().get(0), typeArgMapper, false);
    }
    if (signature.length() > 0)
        signature.append(">");
    signature.append("(");
    for (Type type : parameters) {
        toSignature(signature, type, typeArgMapper, false);
    }
    signature.append(")");
    toSignature(signature, method.returnType(), typeArgMapper, false);
    return signature.toString();
}
 
Example 5
Source Project: quarkus   Source File: Types.java    License: Apache License 2.0 6 votes vote down vote up
static Type box(Primitive primitive) {
    switch (primitive) {
        case BOOLEAN:
            return Type.create(DotNames.BOOLEAN, Kind.CLASS);
        case DOUBLE:
            return Type.create(DotNames.DOUBLE, Kind.CLASS);
        case FLOAT:
            return Type.create(DotNames.FLOAT, Kind.CLASS);
        case LONG:
            return Type.create(DotNames.LONG, Kind.CLASS);
        case INT:
            return Type.create(DotNames.INTEGER, Kind.CLASS);
        case BYTE:
            return Type.create(DotNames.BYTE, Kind.CLASS);
        case CHAR:
            return Type.create(DotNames.CHARACTER, Kind.CLASS);
        case SHORT:
            return Type.create(DotNames.SHORT, Kind.CLASS);
        default:
            throw new IllegalArgumentException("Unsupported primitive: " + primitive);
    }
}
 
Example 6
private static void addReflectiveType(IndexView index, Set<DotName> reflectiveClassCollector,
        Set<Type> reflectiveTypeCollector, Type type) {
    if (type instanceof VoidType || type instanceof PrimitiveType || type instanceof UnresolvedTypeVariable) {
        return;
    } else if (type instanceof ClassType) {
        ClassInfo classInfo = index.getClassByName(type.name());
        addReflectiveClass(index, reflectiveClassCollector, reflectiveTypeCollector, classInfo);
    } else if (type instanceof ArrayType) {
        addReflectiveType(index, reflectiveClassCollector, reflectiveTypeCollector, type.asArrayType().component());
    } else if (type instanceof ParameterizedType) {
        ParameterizedType parameterizedType = type.asParameterizedType();
        addReflectiveType(index, reflectiveClassCollector, reflectiveTypeCollector, parameterizedType.owner());
        for (Type typeArgument : parameterizedType.arguments()) {
            addReflectiveType(index, reflectiveClassCollector, reflectiveTypeCollector, typeArgument);
        }
    }
}
 
Example 7
Source Project: quarkus   Source File: JpaJandexScavenger.java    License: Apache License 2.0 6 votes vote down vote up
private static void collectEmbeddedTypes(Set<DotName> embeddedTypes, Type indexType) {
    switch (indexType.kind()) {
        case CLASS:
            embeddedTypes.add(indexType.asClassType().name());
            break;
        case PARAMETERIZED_TYPE:
            embeddedTypes.add(indexType.name());
            for (Type typeArgument : indexType.asParameterizedType().arguments()) {
                collectEmbeddedTypes(embeddedTypes, typeArgument);
            }
            break;
        case ARRAY:
            collectEmbeddedTypes(embeddedTypes, indexType.asArrayType().component());
            break;
        default:
            // do nothing
            break;
    }
}
 
Example 8
Source Project: smallrye-graphql   Source File: Classes.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Check if this type is a Number (or collection of numbers)
 * 
 * @param type the type to check
 * @return true if it is
 */
public static boolean isNumberLikeTypeOrCollectionThereOf(Type type) {
    return isTypeOrCollectionThereOf(type,
            BYTE,
            BYTE_PRIMATIVE,
            SHORT,
            SHORT_PRIMATIVE,
            INTEGER,
            INTEGER_PRIMATIVE,
            BIG_INTEGER,
            DOUBLE,
            DOUBLE_PRIMATIVE,
            BIG_DECIMAL,
            LONG,
            LONG_PRIMATIVE,
            FLOAT,
            FLOAT_PRIMATIVE);
}
 
Example 9
Source Project: smallrye-open-api   Source File: SchemaFactory.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Introspect into the given Class to generate a Schema model. The boolean indicates
 * whether this class type should be turned into a reference.
 *
 * @param index the index of classes being scanned
 * @param type the implementation type of the item to scan
 * @param schemaReferenceSupported
 */
static Schema readClassSchema(IndexView index, Type type, boolean schemaReferenceSupported) {
    if (type == null) {
        return null;
    }
    Schema schema;
    if (type.kind() == Type.Kind.ARRAY) {
        schema = new SchemaImpl().type(SchemaType.ARRAY);
        ArrayType array = type.asArrayType();
        int dimensions = array.dimensions();
        Type componentType = array.component();

        if (dimensions > 1) {
            // Recurse using a new array type with dimensions decremented
            schema.items(readClassSchema(index, ArrayType.create(componentType, dimensions - 1), schemaReferenceSupported));
        } else {
            // Recurse using the type of the array elements
            schema.items(readClassSchema(index, componentType, schemaReferenceSupported));
        }
    } else if (type.kind() == Type.Kind.PRIMITIVE) {
        schema = OpenApiDataObjectScanner.process(type.asPrimitiveType());
    } else {
        schema = introspectClassToSchema(index, type.asClassType(), schemaReferenceSupported);
    }
    return schema;
}
 
Example 10
Source Project: smallrye-open-api   Source File: AnnotationScanner.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Extracts all methods from the provided class and its ancestors that are known to the instance's index
 * 
 * @param context the scanning context
 * @param resource the resource class
 * @return all methods from the provided class and its ancestors
 */
default List<MethodInfo> getResourceMethods(final AnnotationScannerContext context, ClassInfo resource) {
    Type resourceType = Type.create(resource.name(), Type.Kind.CLASS);
    Map<ClassInfo, Type> chain = JandexUtil.inheritanceChain(context.getIndex(), resource, resourceType);
    List<MethodInfo> methods = new ArrayList<>();

    for (ClassInfo classInfo : chain.keySet()) {
        methods.addAll(classInfo.methods());

        classInfo.interfaceTypes()
                .stream()
                .map(iface -> context.getIndex().getClassByName(TypeUtil.getName(iface)))
                .filter(Objects::nonNull)
                .flatMap(iface -> iface.methods().stream())
                .forEach(methods::add);
    }

    return methods;
}
 
Example 11
Source Project: quarkus   Source File: JandexUtil.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("incomplete-switch")
public static String getBoxedTypeName(Type type) {
    switch (type.kind()) {
        case PRIMITIVE:
            switch (type.asPrimitiveType().primitive()) {
                case BOOLEAN:
                    return "java.lang.Boolean";
                case BYTE:
                    return "java.lang.Byte";
                case CHAR:
                    return "java.lang.Character";
                case DOUBLE:
                    return "java.lang.Double";
                case FLOAT:
                    return "java.lang.Float";
                case INT:
                    return "java.lang.Integer";
                case LONG:
                    return "java.lang.Long";
                case SHORT:
                    return "java.lang.Short";
            }
    }
    return type.toString();
}
 
Example 12
Source Project: quarkus   Source File: InterceptedStaticMethodsProcessor.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void visitEnd() {
    // Invoke the initializer, i.e. Foo_InterceptorInitializer.hash("ping")
    MethodDescriptor descriptor = MethodDescriptor.of(interceptedStaticMethod.getMethod());
    int paramSlot = 0;
    for (Type paramType : interceptedStaticMethod.getMethod().parameters()) {
        superVisitor.visitIntInsn(AsmUtil.getLoadOpcode(paramType), paramSlot);
        paramSlot += AsmUtil.getParameterSize(paramType);
    }
    superVisitor.visitMethodInsn(Opcodes.INVOKESTATIC,
            initializerClassName.replace('.', '/'), interceptedStaticMethod.getHash(),
            descriptor.getDescriptor().toString(),
            false);
    superVisitor.visitInsn(AsmUtil.getReturnInstruction(interceptedStaticMethod.getMethod().returnType()));
    superVisitor.visitMaxs(0, 0);
    superVisitor.visitEnd();

    super.visitEnd();
}
 
Example 13
Source Project: quarkus   Source File: Methods.java    License: Apache License 2.0 6 votes vote down vote up
static boolean matchesSignature(MethodInfo method, MethodInfo subclassMethod) {
    if (!method.name().equals(subclassMethod.name())) {
        return false;
    }
    List<Type> parameters = method.parameters();
    List<Type> subParameters = subclassMethod.parameters();

    int paramCount = parameters.size();
    if (paramCount != subParameters.size()) {
        return false;
    }

    if (paramCount == 0) {
        return true;
    }

    for (int i = 0; i < paramCount; i++) {
        if (!Methods.isTypeEqual(parameters.get(i), subParameters.get(i))) {
            return false;
        }
    }

    return true;
}
 
Example 14
Source Project: quarkus   Source File: BeanArchives.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Collection<ClassInfo> getKnownDirectImplementors(DotName className) {
    if (additionalClasses.isEmpty()) {
        return index.getKnownDirectImplementors(className);
    }
    Set<ClassInfo> directImplementors = new HashSet<ClassInfo>(index.getKnownDirectImplementors(className));
    for (Optional<ClassInfo> additional : additionalClasses.values()) {
        if (!additional.isPresent()) {
            continue;
        }
        for (Type interfaceType : additional.get().interfaceTypes()) {
            if (className.equals(interfaceType.name())) {
                directImplementors.add(additional.get());
                break;
            }
        }
    }
    return directImplementors;
}
 
Example 15
Source Project: quarkus   Source File: BeanInfo.java    License: Apache License 2.0 5 votes vote down vote up
BeanInfo(AnnotationTarget target, BeanDeployment beanDeployment, ScopeInfo scope, Set<Type> types,
        Set<AnnotationInstance> qualifiers,
        List<Injection> injections, BeanInfo declaringBean, DisposerInfo disposer, Integer alternativePriority,
        List<StereotypeInfo> stereotypes,
        String name, boolean isDefaultBean) {
    this(null, null, target, beanDeployment, scope, types, qualifiers, injections, declaringBean, disposer,
            alternativePriority,
            stereotypes, name, isDefaultBean, null, null,
            Collections.emptyMap(), true);
}
 
Example 16
Source Project: smallrye-open-api   Source File: AnnotationScanner.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Go through the method parameters looking for one that is not annotated with a jax-rs/spring
 * annotation.That will be the one that is the request body.
 * 
 * @param method MethodInfo
 * @param extensions available extensions
 * @return Type
 */
default Type getRequestBodyParameterClassType(MethodInfo method, List<AnnotationScannerExtension> extensions) {
    List<Type> methodParams = method.parameters();
    if (methodParams.isEmpty()) {
        return null;
    }
    for (short i = 0; i < methodParams.size(); i++) {
        List<AnnotationInstance> parameterAnnotations = JandexUtil.getParameterAnnotations(method, i);
        if (parameterAnnotations.isEmpty()
                || !containsScannerAnnotations(parameterAnnotations, extensions)) {
            return methodParams.get(i);
        }
    }
    return null;
}
 
Example 17
Source Project: quarkus   Source File: GenerationUtil.java    License: Apache License 2.0 5 votes vote down vote up
static MethodDescriptor toMethodDescriptor(String generatedClassName, MethodInfo methodInfo) {
    final List<String> parameterTypesStr = new ArrayList<>();
    for (Type parameter : methodInfo.parameters()) {
        parameterTypesStr.add(parameter.name().toString());
    }
    return MethodDescriptor.ofMethod(generatedClassName, methodInfo.name(), methodInfo.returnType().name().toString(),
            parameterTypesStr.toArray(new String[0]));
}
 
Example 18
Source Project: smallrye-open-api   Source File: TypeResolver.java    License: Apache License 2.0 5 votes vote down vote up
private TypeResolver(String propertyName, FieldInfo field, Deque<Map<String, Type>> resolutionStack) {
    this.propertyName = propertyName;
    this.field = field;
    this.resolutionStack = resolutionStack;

    if (field != null) {
        this.leaf = field.type();
        targets.add(field);
    } else {
        this.leaf = null;
    }
}
 
Example 19
Source Project: smallrye-open-api   Source File: IgnoreTests.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testIgnore_jsonIgnorePropertiesOnClass() throws IOException, JSONException {
    String name = IgnoreTestContainer.class.getName();
    Type type = getFieldFromKlazz(name, "jipOnClassTest").type();
    OpenApiDataObjectScanner scanner = new OpenApiDataObjectScanner(index, type);

    Schema result = scanner.process();

    printToConsole(name, result);
    assertJsonEquals(name, "ignore.jsonIgnorePropertiesOnClass.expected.json", result);
}
 
Example 20
Source Project: quarkus   Source File: SmallRyeJwtProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep
void registerOptionalClaimProducer(BeanRegistrationPhaseBuildItem beanRegistrationPhase,
        BuildProducer<BeanConfiguratorBuildItem> beanConfigurator) {

    Set<Type> additionalTypes = new HashSet<>();

    // First analyze all relevant injection points
    for (InjectionPointInfo injectionPoint : beanRegistrationPhase.getContext().get(BuildExtension.Key.INJECTION_POINTS)) {
        if (injectionPoint.hasDefaultedQualifier()) {
            continue;
        }
        AnnotationInstance claimQualifier = injectionPoint.getRequiredQualifier(CLAIM_NAME);
        if (claimQualifier != null && injectionPoint.getRequiredType().name().equals(DotNames.PROVIDER)) {
            // Classes from javax.json are handled specially
            Type actualType = injectionPoint.getRequiredType().asParameterizedType().arguments().get(0);
            if (actualType.name().equals(DotNames.OPTIONAL) && !actualType.name().toString()
                    .startsWith("javax.json")) {
                additionalTypes.add(actualType);
            }
        }
    }

    // Register a custom bean
    BeanConfigurator<Optional<?>> configurator = beanRegistrationPhase.getContext().configure(Optional.class);
    for (Type type : additionalTypes) {
        configurator.addType(type);
    }
    configurator.scope(BuiltinScope.DEPENDENT.getInfo());
    configurator.qualifiers(AnnotationInstance.create(CLAIM_NAME, null,
            new AnnotationValue[] { AnnotationValue.createStringValue("value", ""),
                    AnnotationValue.createEnumValue("standard", CLAIMS_NAME, "UNKNOWN") }));
    configurator.creator(RawOptionalClaimCreator.class);
    beanConfigurator.produce(new BeanConfiguratorBuildItem(configurator));
}
 
Example 21
@Override
public void registerCustomSchemas(SchemaRegistry schemaRegistry) {
    Type uuidType = Type.create(componentize(UUID.class.getName()), Kind.CLASS);
    Schema schema = new SchemaImpl();
    schema.setType(Schema.SchemaType.STRING);
    schema.setFormat("uuid");
    schema.setPattern("^[a-f0-9]{8}-?[a-f0-9]{4}-?[1-5][a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}$");
    schema.setTitle("UUID");
    schema.setDescription("Universally Unique Identifier");
    schema.setExample("de8681db-b4d6-4c47-a428-4b959c1c8e9a");
    schemaRegistry.register(uuidType, schema);
}
 
Example 22
Source Project: quarkus   Source File: HibernateValidatorProcessor.java    License: Apache License 2.0 5 votes vote down vote up
private static DotName getClassName(Type type) {
    switch (type.kind()) {
        case CLASS:
        case PARAMETERIZED_TYPE:
            return type.name();
        case ARRAY:
            return getClassName(type.asArrayType().component());
        default:
            return null;
    }
}
 
Example 23
Source Project: smallrye-open-api   Source File: TypeUtil.java    License: Apache License 2.0 5 votes vote down vote up
public static Type getBound(WildcardType wct) {
    if (wct.extendsBound() != null) {
        return wct.extendsBound();
    } else {
        return OBJECT_TYPE;
    }
}
 
Example 24
Source Project: smallrye-graphql   Source File: OperationCreator.java    License: Apache License 2.0 5 votes vote down vote up
private static void validateFieldType(MethodInfo methodInfo, OperationType operationType) {
    Type returnType = methodInfo.returnType();
    if (returnType.kind().equals(Type.Kind.VOID)) {
        throw new SchemaBuilderException(
                "Can not have a void return for [" + operationType.name()
                        + "] on method [" + methodInfo.name() + "]");
    }
}
 
Example 25
Source Project: quarkus   Source File: KafkaProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@BuildStep
public void withSasl(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy) {

    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, AbstractLogin.DefaultLoginCallbackHandler.class));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, SaslClientCallbackHandler.class));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DefaultLogin.class));

    final Type loginModuleType = Type
            .create(DotName.createSimple(LoginModule.class.getName()), Kind.CLASS);

    reflectiveHierarchy.produce(new ReflectiveHierarchyBuildItem(loginModuleType));
}
 
Example 26
Source Project: quarkus   Source File: Types.java    License: Apache License 2.0 5 votes vote down vote up
static <T extends Type> Map<TypeVariable, Type> buildResolvedMap(List<T> resolvedArguments,
        List<TypeVariable> typeVariables,
        Map<TypeVariable, Type> resolvedTypeParameters, IndexView index) {
    Map<TypeVariable, Type> resolvedMap = new HashMap<>();
    for (int i = 0; i < resolvedArguments.size(); i++) {
        resolvedMap.put(typeVariables.get(i), resolveTypeParam(resolvedArguments.get(i), resolvedTypeParameters, index));
    }
    return resolvedMap;
}
 
Example 27
Source Project: quarkus   Source File: IndexClassLookupUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @param index
 * @param type
 * @return the class for the given type or {@code null} for primitives, arrays and
 */
static ClassInfo getClassByName(IndexView index, Type type) {
    if (type != null && (type.kind() == Kind.CLASS || type.kind() == Kind.PARAMETERIZED_TYPE)) {
        return getClassByName(index, type.name());
    }
    return null;
}
 
Example 28
Source Project: smallrye-open-api   Source File: DataObjectDeque.java    License: Apache License 2.0 5 votes vote down vote up
private boolean argsEqual(PathEntry otherPair) {
    ParameterizedType thisClazzPType = clazzType.asParameterizedType();
    ParameterizedType otherClazzPType = otherPair.clazzType.asParameterizedType();

    List<Type> thisArgs = thisClazzPType.arguments();
    List<Type> otherArgs = otherClazzPType.arguments();
    return thisArgs.equals(otherArgs);
}
 
Example 29
Source Project: quarkus   Source File: EventBusCodecProcessor.java    License: Apache License 2.0 5 votes vote down vote up
private static Type extractPayloadTypeFromReturn(MethodInfo method) {
    Type returnType = method.returnType();
    if (returnType.kind() == Type.Kind.CLASS) {
        return returnType;
    } else if (returnType.kind() == Type.Kind.PARAMETERIZED_TYPE) {
        ParameterizedType returnedParamType = returnType.asParameterizedType();
        if (!returnedParamType.arguments().isEmpty()
                && (returnedParamType.name().equals(COMPLETION_STAGE) || returnedParamType.name().equals(UNI))) {
            return returnedParamType.arguments().get(0);
        } else {
            return returnedParamType;
        }
    }
    return null;
}
 
Example 30
Source Project: smallrye-graphql   Source File: Classes.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Check if this type is a Date (or collection of numbers)
 * 
 * @param type the type to check
 * @return true if it is
 */
public static boolean isDateLikeTypeOrCollectionThereOf(Type type) {
    return isTypeOrCollectionThereOf(type,
            LOCALDATE,
            LOCALTIME,
            LOCALDATETIME,
            ZONEDDATETIME,
            OFFSETDATETIME,
            OFFSETTIME,
            UTIL_DATE,
            SQL_DATE,
            SQL_TIMESTAMP,
            SQL_TIME);
}