T
- public class JaxbFactory<T> extends Object implements JaxbFactoryApi<T>
Constructor and Description |
---|
JaxbFactory(Class<T> pClassOfT)
construct me for the given T class - workaround for java generics type
erasure
|
Modifier and Type | Method and Description |
---|---|
String |
asJson(T instance)
create a Json representation for the given
|
String |
asXML(T instance)
create an xml representation for the given
|
T |
fromJson(String json)
get an instance of T for the given json string
|
T |
fromString(Unmarshaller u,
String s) |
T |
fromXML(String xml)
get an instance of T for the given xml string
|
Class<T> |
getClassOfT()
allow access to the type that would otherwise not be available due to Java
type erasure
|
Marshaller |
getMarshaller(T instance)
get a marshaller for the given
|
String |
getString(Marshaller marshaller,
T instance)
get the string representation of the given marshaller
|
Unmarshaller |
getUnmarshaller()
get a fitting Unmarshaller
|
protected static Logger LOGGER
public Class<T> getClassOfT()
public Unmarshaller getUnmarshaller() throws JAXBException
JAXBException
public T fromString(Unmarshaller u, String s) throws Exception
Exception
public T fromXML(String xml) throws Exception
fromXML
in interface JaxbFactoryApi<T>
xml
- - the xml representation of the Exception
- - if the conversion failspublic T fromJson(String json) throws Exception
fromJson
in interface JaxbFactoryApi<T>
json
- - the json representation of the Exception
public Marshaller getMarshaller(T instance) throws JAXBException
instance
- - the instance to get a marshaller forJAXBException
public String getString(Marshaller marshaller, T instance) throws JAXBException
marshaller
- instance
- JAXBException
public String asJson(T instance) throws JAXBException
asJson
in interface JaxbFactoryApi<T>
instance
- - the instance to convert to jsonJAXBException
public String asXML(T instance) throws JAXBException
asXML
in interface JaxbFactoryApi<T>
instance
- - the instance to convert to xmlJAXBException
Copyright © 2018 BITPlan GmbH. All rights reserved.