title: How to pass '<ClassName>.class' as an argument in java?
body: <p>I am trying to make a generalized method which would convert a POJO object to a XML string. </p>
  
  <p>And I am trying to use this method to achieve this goal.</p>
  
  <pre><code>public class Util{
  
      public static String jaxbObjectToXML(Object xmlObj) {
          String xmlString = "";
          try {
              JAXBContext context = JAXBContext.newInstance(POJO.class);
              Marshaller marshaller = context.createMarshaller();
              marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
              marshaller.marshal(xmlObj, stringWriter);
              xmlString = stringWriter.toString();
          } catch (JAXBException e) {
              e.printStackTrace();
          }
          return xmlString;
      }
  }
  </code></pre>
  
  <p>Now in line <code>JAXBContext context = JAXBContext.newInstance(**POJO.class**);</code> , I am trying to get this POJO value to be generic.
  Like if I could pass the class name, object or something which could do the work. Also adding the appropriate parameter to the method. </p>