public final String toXml(final Object obj) throws MessageConversionException {
  Serializer serializer=new Persister(new AnnotationStrategy());
  StringWriter fw=null;
  String result=null;
  try {
    fw=new StringWriter();
    if (obj instanceof ProcessConnectionRequest) {
      LOGGER.trace("toXml() : converting from ProcessConnectionRequest to XML.");
      serializer.write(((ProcessConnectionRequest)obj),fw);
    }
 else     if (obj instanceof ProcessConnectionResponse) {
      LOGGER.trace("toXml() : converting from ProcessConnectionResponse to XML.");
      serializer.write(((ProcessConnectionResponse)obj),fw);
    }
 else     if (obj instanceof ProcessConfigurationRequest) {
      LOGGER.trace("toXml() : converting from ProcessConfigurationRequest to XML.");
      serializer.write(((ProcessConfigurationRequest)obj),fw);
    }
 else     if (obj instanceof ProcessConfigurationResponse) {
      LOGGER.trace("toXml() : converting from ProcessConfigurationResponse to XML.");
      serializer.write(((ProcessConfigurationResponse)obj),fw);
    }
 else     if (obj instanceof ProcessDisconnectionRequest) {
      LOGGER.trace("toXml() : converting from ProcessDisconnectionRequest to XML.");
      serializer.write(((ProcessDisconnectionRequest)obj),fw);
    }
 else {
      LOGGER.error("Object type not found: " + obj.getClass());
      throw new MessageConversionException("toXml() : unsupported type");
    }
    result=fw.toString();
  }
 catch (  Exception e) {
    LOGGER.error("Error converting object " + obj + " to XML: "+ e);
  }
 finally {
    if (fw != null) {
      try {
        fw.close();
      }
 catch (      IOException e) {
        LOGGER.error("toXml(): Error closing file. " + e);
        e.printStackTrace();
      }
    }
  }
  return result;
}

public final String toXml ( final Object obj ) throws MessageConversionException { Serializer serializer = new Persister ( new AnnotationStrategy ( ) ) ; StringWriter fw = null ; String result = null ; try { fw = new StringWriter ( ) ; if ( obj instanceof ProcessConnectionRequest ) { LOGGER . trace ( "toXml() : converting from ProcessConnectionRequest to XML." ) ; serializer . write ( ( ( ProcessConnectionRequest ) obj ) , fw ) ; } else if ( obj instanceof ProcessConnectionResponse ) { LOGGER . trace ( "toXml() : converting from ProcessConnectionResponse to XML." ) ; serializer . write ( ( ( ProcessConnectionResponse ) obj ) , fw ) ; } else if ( obj instanceof ProcessConfigurationRequest ) { LOGGER . trace ( "toXml() : converting from ProcessConfigurationRequest to XML." ) ; serializer . write ( ( ( ProcessConfigurationRequest ) obj ) , fw ) ; } else if ( obj instanceof ProcessConfigurationResponse ) { LOGGER . trace ( "toXml() : converting from ProcessConfigurationResponse to XML." ) ; serializer . write ( ( ( ProcessConfigurationResponse ) obj ) , fw ) ; } else if ( obj instanceof ProcessDisconnectionRequest ) { LOGGER . trace ( "toXml() : converting from ProcessDisconnectionRequest to XML." ) ; serializer . write ( ( ( ProcessDisconnectionRequest ) obj ) , fw ) ; } else { LOGGER . error ( "Object type not found: " + obj . getClass ( ) ) ; throw new MessageConversionException ( "toXml() : unsupported type" ) ; } result = fw . toString ( ) ; } catch ( Exception e ) { LOGGER . error ( "Error converting object " + obj + " to XML: " + e ) ; } finally { if ( fw != null ) { try { fw . close ( ) ; } catch ( IOException e ) { LOGGER . error ( "toXml(): Error closing file. " + e ) ; e . printStackTrace ( ) ; } } } return result ; }
creates a xml representation of this class by making use of the simpleframework xml library .
