com.undefinedlabs.scope.rules.utils.MessageProducerContextExtractorResolver Maven / Gradle / Ivy
package com.undefinedlabs.scope.rules.utils;
import com.undefinedlabs.scope.rules.utils.extractors.MessageProducerContextExtractorDestMsgFull;
import com.undefinedlabs.scope.rules.utils.extractors.MessageProducerContextExtractorNoop;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
public enum MessageProducerContextExtractorResolver {
INSTANCE;
private static final Map extractorByMethodSignature = new HashMap<>();
static {
extractorByMethodSignature.put(MessageProducerContextExtractorDestMsgFull.DEST_MSG_FULL_METHOD_PARAMS_SIGNATURE, MessageProducerContextExtractorDestMsgFull.INSTANCE);
}
public MessageProducerContextExtractor resolve(final String methodSignature) {
if(StringUtils.isEmpty(methodSignature)){
return MessageProducerContextExtractorNoop.INSTANCE;
}
final MessageProducerContextExtractor messageProducerContextExtractor = extractorByMethodSignature.get(MessageProducerMethodSignatureExtractor.INSTANCE.extract(methodSignature));
return messageProducerContextExtractor != null ? messageProducerContextExtractor : MessageProducerContextExtractorNoop.INSTANCE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy