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

com.dell.cpsd.common.rabbitmq.registration.DefaultClassMapperFactory Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
/**
 * Copyright © 2017 Dell Inc. or its subsidiaries.  All Rights Reserved.
 * Dell EMC Confidential/Proprietary Information
 */

package com.dell.cpsd.common.rabbitmq.registration;

import com.dell.cpsd.common.rabbitmq.MessageAnnotationProcessor;
import com.dell.cpsd.common.rabbitmq.MessageAnnotationProcessorCallback;
import org.springframework.amqp.support.converter.ClassMapper;
import org.springframework.amqp.support.converter.DefaultClassMapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * The is a factory for default retry templates.
 * 

*

*

* Copyright © 2017 Dell Inc. or its subsidiaries. All Rights Reserved. * Dell EMC Confidential/Proprietary Information *

* * @since 1.1 */ public class DefaultClassMapperFactory { /** * This creates the DefaultClassMapper with the list of message * classes. * * @param messageClasses The list of message classes. * @return The default class mapper with the message classes. * @since 1.1 */ public static ClassMapper makeClassMapper(final List> messageClasses) { if (messageClasses == null) { throw new IllegalArgumentException("The message class list is null."); } final DefaultClassMapper classMapper = new DefaultClassMapper(); final Map> classMappings = new HashMap<>(); final MessageAnnotationProcessor messageAnnotationProcessor = new MessageAnnotationProcessor(); messageAnnotationProcessor.process(new MessageAnnotationProcessorCallback() { @Override public void found(String messageType, Class messageClass) { classMappings.put(messageType, messageClass); } }, messageClasses); classMapper.setIdClassMapping(classMappings); return classMapper; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy