Apache.NMS.ActiveMQ.Commands.ActiveMQDestination.Transform C# (CSharp) Method

Transform() public static method

public static Transform ( IDestination destination ) : ActiveMQDestination
destination IDestination
return ActiveMQDestination
        public static ActiveMQDestination Transform(IDestination destination)
        {
            ActiveMQDestination result = null;
            if(destination != null)
            {
                if(destination is ActiveMQDestination)
                {
                    result = (ActiveMQDestination) destination;
                }
                else
                {
                    if(destination is ITemporaryQueue)
                    {
                        result = new ActiveMQTempQueue(((IQueue) destination).QueueName);
                    }
                    else if(destination is ITemporaryTopic)
                    {
                        result = new ActiveMQTempTopic(((ITopic) destination).TopicName);
                    }
                    else if(destination is IQueue)
                    {
                        result = new ActiveMQQueue(((IQueue) destination).QueueName);
                    }
                    else if(destination is ITopic)
                    {
                        result = new ActiveMQTopic(((ITopic) destination).TopicName);
                    }
                }
            }
            return result;
        }