I want to make generic function that return Object representation of XML document (using JAXB). I need to pass \"class\" object to JAXBContext constructor, but how I can get it
You cannot get the class of at run time. Java implements Generics using Type Safe Erasure which means that the understanding of the Generic type is only applied at up through compilation. You must interogate the actual object at run time if you want to get its class.