class MarshalledClassDestination implements MessageDrivenDestination {

  @Override
  public String getDestination(AdaptrisMessage msg) {
    String destination = null;
    Object msgObject = null;
    try {
      msgObject = marshallerToUse().unmarshal(msg.getContent());
      String className = msgObject.getClass().getName();
      logR.trace("Unmarshalled [" + className + "]");
      if (mappings.contains(new KeyValuePair(className, ""))) {

        destination = mappings.getValue(className);
      }
      else {
        logR.trace("[" + className + "] not found, using default");
        destination = defaultDestination;
      }
    }
    catch (Exception e) {
      logR.trace("Payload could not be unmarshalled using default destination");
      destination = defaultDestination;
    }

    logR.trace("Destination for message [" + destination +"]");
    if (StringUtils.isEmpty(destination)) {
      throw new RuntimeException("Could not resolve destination");
    }
    return destination;
  }

  public  MarshalledClassDestination();

}