Class JAXBTransformer

java.lang.Object
lt.viko.eif.jguscia.services.JAXBTransformer

public class JAXBTransformer extends Object
Utility class responsible for converting between XML strings and Java objects using JAXB. <p> It provides methods for transforming XML data into POJO objects and converting POJO objects back into XML format.
  • Constructor Details

    • JAXBTransformer

      public JAXBTransformer()
  • Method Details

    • transformToPOJO

      public static Books transformToPOJO(String xml) throws Exception
      Converts an XML string into a Books Java object.
      Parameters:
      xml - XML content representing a collection of books
      Returns:
      a Books object created from the XML data
      Throws:
      Exception - if the XML cannot be parsed or mapped
    • transformToXML

      public static String transformToXML(Books books) throws Exception
      Converts a Books Java object into an XML string.
      Parameters:
      books - object containing book data to be converted into XML
      Returns:
      formatted XML representation of the provided books object
      Throws:
      Exception - if the XML transformation fails