All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.iris_events.asyncapi.parsers.RpcResponseClassParser Maven / Gradle / Ivy

There is a newer version: 6.1.8
Show newest version
package org.iris_events.asyncapi.parsers;

import org.iris_events.annotations.Message;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;
import org.jboss.jandex.Type;

public class RpcResponseClassParser {

    private static final String RPC_RESPONSE_CLASS_PARAM = "rpcResponse";

    public static Type getFromAnnotationClass(Message messageAnnotation) {
        return Type.create(DotName.createSimple(messageAnnotation.rpcResponse()), Type.Kind.CLASS);
    }

    public static Type getFromAnnotationInstance(AnnotationInstance annotation, IndexView index) {
        final var annotationValue = annotation.valueWithDefault(index, RPC_RESPONSE_CLASS_PARAM);
        if (annotationValue == null
                || annotationValue.asClass().equals(Type.create(DotName.createSimple(java.lang.Void.class), Type.Kind.CLASS))) {
            return null;
        }
        return annotationValue.asClass();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy