java.lang.Object
io.github.astrapi69.jaxb.factory.MarshallerFactory
The factory class
MarshallerFactory
for creating Marshaller
objects for
serializing java beans to xml string-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic jakarta.xml.bind.Marshaller
addProperties
(@NonNull jakarta.xml.bind.Marshaller marshaller, Map<String, Object> marshallerProperties) Add the given marshaller properties to the givenMarshaller
objectstatic jakarta.xml.bind.Marshaller
newMarshaller
(@NonNull Class clazz) Factory method for create a newMarshaller
objectstatic jakarta.xml.bind.Marshaller
newMarshaller
(jakarta.xml.bind.JAXBContext context, @NonNull Class clazz) Factory method for create a newMarshaller
objectstatic jakarta.xml.bind.Marshaller
newMarshaller
(jakarta.xml.bind.JAXBContext context, @NonNull Class clazz, Map<String, Object> marshallerProperties) Factory method for create a newMarshaller
objectstatic <T> jakarta.xml.bind.Marshaller
newMarshaller
(T object) Factory method for create a newMarshaller
objectstatic <T> jakarta.xml.bind.Marshaller
newPrettyPrintMarshaller
(T object) Factory method for create a newMarshaller
object that can make a pretty print of the xml output
-
Constructor Details
-
MarshallerFactory
public MarshallerFactory()
-
-
Method Details
-
newMarshaller
public static jakarta.xml.bind.Marshaller newMarshaller(@NonNull @NonNull Class clazz) throws jakarta.xml.bind.JAXBException Factory method for create a newMarshaller
object- Parameters:
clazz
- theClass
object- Returns:
- the new created
Marshaller
object - Throws:
jakarta.xml.bind.JAXBException
- is thrown if an error was encountered while creating theJAXBContext
-
newMarshaller
public static jakarta.xml.bind.Marshaller newMarshaller(jakarta.xml.bind.JAXBContext context, @NonNull @NonNull Class clazz) throws jakarta.xml.bind.JAXBException Factory method for create a newMarshaller
object- Parameters:
context
- theJAXBContext
objectclazz
- theClass
object- Returns:
- the new created
Marshaller
object - Throws:
jakarta.xml.bind.JAXBException
- is thrown if an error was encountered while creating theJAXBContext
-
newMarshaller
public static <T> jakarta.xml.bind.Marshaller newMarshaller(@NonNull T object) throws jakarta.xml.bind.JAXBException Factory method for create a newMarshaller
object- Type Parameters:
T
- the generic type of the given object- Parameters:
object
- the generic object- Returns:
- the new created
Marshaller
object - Throws:
jakarta.xml.bind.JAXBException
- is thrown if an error was encountered while creating theJAXBContext
-
newPrettyPrintMarshaller
public static <T> jakarta.xml.bind.Marshaller newPrettyPrintMarshaller(@NonNull T object) Factory method for create a newMarshaller
object that can make a pretty print of the xml output- Type Parameters:
T
- the generic type of the given object- Parameters:
object
- the generic object- Returns:
- the new created
Marshaller
object
-
newMarshaller
public static jakarta.xml.bind.Marshaller newMarshaller(jakarta.xml.bind.JAXBContext context, @NonNull @NonNull Class clazz, Map<String, Object> marshallerProperties) throws jakarta.xml.bind.JAXBExceptionFactory method for create a newMarshaller
object -
addProperties
public static jakarta.xml.bind.Marshaller addProperties(@NonNull @NonNull jakarta.xml.bind.Marshaller marshaller, Map<String, Object> marshallerProperties) throws jakarta.xml.bind.PropertyExceptionAdd the given marshaller properties to the givenMarshaller
object- Parameters:
marshaller
- theMarshaller
objectmarshallerProperties
- theMap
object with the marshaller properties- Returns:
- the new
Marshaller
object with the given marshaller properties - Throws:
jakarta.xml.bind.PropertyException
- is thrown if there is an error processing the given property or value
-