private void getAnnotationValueFromAnnotationSource()

in apm-agent-plugins/apm-jaxrs-plugin/src/main/java/co/elastic/apm/agent/jaxrs/JaxRsOffsetMappingFactory.java [93:132]


    private void getAnnotationValueFromAnnotationSource(TransactionAnnotationValue transactionAnnotationValue, AnnotationSource annotationSource, Boolean isClassLevelPath) {
        for (TypeDescription classMethodTypeDescription : annotationSource.getDeclaredAnnotations().asTypeList()) {
            String canonicalName = classMethodTypeDescription.getCanonicalName();
            switch (canonicalName) {
                case "jakarta.ws.rs.Path":
                case "javax.ws.rs.Path":
                    String pathValue = getAnnotationValue(annotationSource, classMethodTypeDescription, "value");
                    if (isClassLevelPath) {
                        transactionAnnotationValue.setClassLevelPath(pathValue);
                    } else {
                        transactionAnnotationValue.setMethodLevelPath(pathValue);
                    }
                    break;
                case "jakarta.ws.rs.GET":
                case "javax.ws.rs.GET":
                    transactionAnnotationValue.setMethodIfNotNull("GET");
                    break;
                case "jakarta.ws.rs.POST":
                case "javax.ws.rs.POST":
                    transactionAnnotationValue.setMethodIfNotNull("POST");
                    break;
                case "jakarta.ws.rs.PUT":
                case "javax.ws.rs.PUT":
                    transactionAnnotationValue.setMethodIfNotNull("PUT");
                    break;
                case "jakarta.ws.rs.DELETE":
                case "javax.ws.rs.DELETE":
                    transactionAnnotationValue.setMethodIfNotNull("DELETE");
                    break;
                case "jakarta.ws.rs.HEAD":
                case "javax.ws.rs.HEAD":
                    transactionAnnotationValue.setMethodIfNotNull("HEAD");
                    break;
                case "jakarta.ws.rs.OPTIONS":
                case "javax.ws.rs.OPTIONS":
                    transactionAnnotationValue.setMethodIfNotNull("OPTIONS");
                    break;
            }
        }
    }