private void transitionMongoJson(final List<Align> spans) {
        this.transitionAnnotation(spans, new AnnotationReplacementCallback() {
            @Override
            public void replacement(Align align, List<AnnotationBo> annotationBoList) {

                for (int i = 0; i < annotationBoList.size(); i++) {
                    final AnnotationBo annotationBo = annotationBoList.get(i);
                    if (annotationBo.getKey() == MongoConstants.MONGO_COLLECTION_INFO.getCode()) {
                        AnnotationBo collectionOption = findAnnotation(annotationBoList, MongoConstants.MONGO_COLLECTION_OPTION.getCode());
                        String collectionValue = getCollectionInfo(align.getDestinationId(), annotationBo, collectionOption);
                        AnnotationBo replace = AnnotationBo.of(annotationBo.getKey(), collectionValue);
                        annotationBoList.set(i, replace);
                    }
                }

                AnnotationBo jsonAnnotation = findAnnotation(annotationBoList, MongoConstants.MONGO_JSON_DATA.getCode());
                if (jsonAnnotation == null) {
                    return;
                }

                final StringStringValue jsonValue = (StringStringValue) jsonAnnotation.getValue();

                final String json = jsonValue.getStringValue1();
                final String jsonbindValue = jsonValue.getStringValue2();

                if (StringUtils.isEmpty(json)) {
                    logger.debug("No values in Json");
                } else {
                    AnnotationBo jsonMeta = AnnotationBo.of(MongoConstants.MONGO_JSON.getCode(), json);
                    annotationBoList.add(jsonMeta);
                }

                if (StringUtils.isNotEmpty(jsonbindValue)) {
                    AnnotationBo bindValueAnnotation = AnnotationBo.of(MongoConstants.MONGO_JSON_BINDVALUE.getCode(), jsonbindValue);
                    annotationBoList.add(bindValueAnnotation);
                }
            }

            private String getCollectionInfo(String destinationId, AnnotationBo collection, AnnotationBo option) {
                StringBuilder builder = new StringBuilder(32);
                builder.append(destinationId);
                builder.append(".");
                builder.append(collection.getValue());
                if (option != null) {
                    builder.append(" with ");
                    builder.append(Objects.toString(option.getValue(), "").toUpperCase());
                }
                return builder.toString();
            }
        });
    }
@author emeroad
@author jaehong.kim
@author minwoo.jung
web/src/main/java/com/navercorp/pinpoint/web/service/SpanServiceImpl.java