at.gridgears.held.internal.parser.ParseUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of held-api Show documentation
Show all versions of held-api Show documentation
API for Http Enabled Location Discovery (HELD)
package at.gridgears.held.internal.parser;
import javax.xml.bind.JAXBElement;
import javax.xml.datatype.XMLGregorianCalendar;
import java.time.Instant;
import java.util.List;
import java.util.Optional;
final class ParseUtils {
private ParseUtils() {
//must not be instantiated
}
@SuppressWarnings("unchecked")
static Optional getValue(Object element, Class expectedClass) {
T result = null;
if (element instanceof JAXBElement) {
Object value = ((JAXBElement) element).getValue();
if (expectedClass.isAssignableFrom(value.getClass())) {
result = (T) value;
}
}
return Optional.ofNullable(result);
}
static Optional getValue(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy