/// <summary> /// Create a Destination /// </summary> /// <param name="type"></param> /// <param name="pyhsicalName"></param> /// <returns></returns> public static Destination CreateDestination(int type, String pyhsicalName) { Destination result = null; if(pyhsicalName == null) { return null; } else if(type == TOPIC) { result = new Topic(pyhsicalName); } else if(type == TEMPORARY_TOPIC) { result = new TempTopic(pyhsicalName); } else if(type == QUEUE) { result = new Queue(pyhsicalName); } else { result = new TempQueue(pyhsicalName); } return result; }
/// <summary> /// </summary> /// <param name="destination"></param> /// <returns></returns> public static Destination Transform(IDestination destination) { Destination result = null; if(destination != null) { if(destination is Destination) { result = (Destination) destination; } else { if(destination is ITemporaryQueue) { result = new TempQueue(((IQueue) destination).QueueName); } else if(destination is ITemporaryTopic) { result = new TempTopic(((ITopic) destination).TopicName); } else if(destination is IQueue) { result = new Queue(((IQueue) destination).QueueName); } else if(destination is ITopic) { result = new Topic(((ITopic) destination).TopicName); } } } return result; }