Package org.bremersee.gpx
Class GpxJaxbContextHelper
java.lang.Object
org.bremersee.gpx.GpxJaxbContextHelper
GPX XML context helper.
- Author:
- Christian Bremer
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List<T>Find all extensions of the given type.static <T> List<T>findExtensions(Class<T> cls, boolean instancesOf, ExtensionsType extensions, jakarta.xml.bind.JAXBContext jaxbContext) Find all extensions of the given type.static <T> List<T>findExtensions(Class<T> cls, boolean instancesOf, ExtensionsType extensions, jakarta.xml.bind.Unmarshaller unmarshaller) Find all extensions of the given type.static <T> Optional<T>Find the first extension of the given type.static <T> Optional<T>findFirstExtension(Class<T> cls, boolean instancesOf, ExtensionsType extensions, jakarta.xml.bind.JAXBContext jaxbContext) Find the first extension of the given type.static <T> Optional<T>findFirstExtension(Class<T> cls, boolean instancesOf, ExtensionsType extensions, jakarta.xml.bind.Unmarshaller unmarshaller) Find the first extension of the given type.parseExtensions(ExtensionsType extensions, jakarta.xml.bind.JAXBContext jaxbContext) Parses the elemants of the given GPX extensions (ExtensionsType.getAnies()) with the givenJAXBContext:parseExtensions(ExtensionsType extensions, jakarta.xml.bind.Unmarshaller unmarshaller) Parses the elemants of the given GPX extensions (ExtensionsType.getAnies()) with the givenUnmarshaller:
-
Method Details
-
parseExtensions
public static Map<Class<?>,List<Object>> parseExtensions(ExtensionsType extensions, jakarta.xml.bind.JAXBContext jaxbContext) Parses the elemants of the given GPX extensions (ExtensionsType.getAnies()) with the givenJAXBContext:If the
JAXBContextcan unmarshall theElementto a concrete object, a map entry will be created with the class of the object as key and a list with all unmarshalled objects as value.If the
JAXBContextcannot unmarshall theElementto a concrete object, a map entry will be created with the class of the element as key and a list with all elements as value.- Parameters:
extensions- the GPX extensionjaxbContext- theJAXBContextto parse the elements- Returns:
- an unmodifiable map with the unmarshalled objects (key is the class of the objects, value is a list with all unmarshalled objects of this class)
-
parseExtensions
public static Map<Class<?>,List<Object>> parseExtensions(ExtensionsType extensions, jakarta.xml.bind.Unmarshaller unmarshaller) Parses the elemants of the given GPX extensions (ExtensionsType.getAnies()) with the givenUnmarshaller:If the
Unmarshallercan unmarshall theElementto a concrete object, a map entry will be created with the class of the object as key and a list with all unmarshalled objects as value.If the
Unmarshallercannot unmarshall theElementto a concrete object, a map entry will be created with the class of the element as key and a list with all elements as value.- Parameters:
extensions- the GPX extensionunmarshaller- theUnmarshallerto parse the elements- Returns:
- an unmodifiable map with the unmarshalled objects (key is the class of the objects, value is a list with all unmarshalled objects of this class)
-
findExtensions
public static <T> List<T> findExtensions(Class<T> cls, boolean instancesOf, Map<Class<?>, List<Object>> parsedExtensions) Find all extensions of the given type.- Type Parameters:
T- the type- Parameters:
cls- the typeinstancesOf- iftrueinstanceof will be used, otherwiseObject.equals(Object)will be usedparsedExtensions- the parsed extensions (seeparseExtensions(ExtensionsType, JAXBContext))- Returns:
- an unmodifiable list of all extensions of the given type
-
findExtensions
public static <T> List<T> findExtensions(Class<T> cls, boolean instancesOf, ExtensionsType extensions, jakarta.xml.bind.JAXBContext jaxbContext) Find all extensions of the given type.- Type Parameters:
T- the type- Parameters:
cls- the typeinstancesOf- iftrueinstanceof will be used, otherwiseObject.equals(Object)will be usedextensions- the GPX extensionsjaxbContext- theJAXBContextto parse the elements- Returns:
- an unmodifiable list of all extensions of the given type
-
findExtensions
public static <T> List<T> findExtensions(Class<T> cls, boolean instancesOf, ExtensionsType extensions, jakarta.xml.bind.Unmarshaller unmarshaller) Find all extensions of the given type.- Type Parameters:
T- the type- Parameters:
cls- the typeinstancesOf- iftrueinstanceof will be used, otherwiseObject.equals(Object)will be usedextensions- the GPX extensionsunmarshaller- theUnmarshallerto parse the elements- Returns:
- an unmodifiable list of all extensions of the given type
-
findFirstExtension
public static <T> Optional<T> findFirstExtension(Class<T> cls, boolean instancesOf, Map<Class<?>, List<Object>> parsedExtensions) Find the first extension of the given type.- Type Parameters:
T- the type- Parameters:
cls- the typeinstancesOf- iftrueinstanceof will be used, otherwiseObject.equals(Object)will be usedparsedExtensions- the parsed extensions (seeparseExtensions(ExtensionsType, JAXBContext))- Returns:
Optional.empty()if there is no such element, otherwise an optional with the parsed element
-
findFirstExtension
public static <T> Optional<T> findFirstExtension(Class<T> cls, boolean instancesOf, ExtensionsType extensions, jakarta.xml.bind.JAXBContext jaxbContext) Find the first extension of the given type.- Type Parameters:
T- the type- Parameters:
cls- the typeinstancesOf- iftrueinstanceof will be used, otherwiseObject.equals(Object)will be usedextensions- the GPX extensionsjaxbContext- theJAXBContextto parse the elements- Returns:
Optional.empty()if there is no such element, otherwise an optional with the parsed element
-
findFirstExtension
public static <T> Optional<T> findFirstExtension(Class<T> cls, boolean instancesOf, ExtensionsType extensions, jakarta.xml.bind.Unmarshaller unmarshaller) Find the first extension of the given type.- Type Parameters:
T- the type- Parameters:
cls- the typeinstancesOf- iftrueinstanceof will be used, otherwiseObject.equals(Object)will be usedextensions- the GPX extensionsunmarshaller- theUnmarshallerto parse the elements- Returns:
Optional.empty()if there is no such element, otherwise an optional with the parsed element
-