code: private Object getDestinationName(String destinationType, Object destination) throws Exception {
          String methodName;
          if ("javax.jms.Queue".equals(destinationType))
              methodName = "getQueueName";
          else if ("javax.jms.Topic".equals(destinationType))
              methodName = "getTopicName";
          else
              throw new InvalidPropertyException("destinationType: " + destinationType);
  
          try {
              return destination.getClass().getMethod(methodName).invoke(destination);
          } catch (NoSuchMethodException x) {
              throw new InvalidPropertyException(Tr.formatMessage(tc, "J2CA8505.destination.type.mismatch", destination, destinationType), x);
          }
      }
docs: Returns the name of the queue or topic.
  
  @param destinationType type of destination (javax.jms.Queue or javax.jms.Topic).
  @param value instance of the above type.
  @return name of the queue or topic.
  @throws Exception if unable to obtain the destination name.