/*
* Get the DatatypeFactory first because if not available, then we don't need to parse
* the calendar fields. This has the side effect of not validating the calendar fields
* syntax (which should be integer values), but maybe this is what the user wants.
*/
final DatatypeFactory factory = XmlUtilities.getDatatypeFactory();
final org.apache.sis.internal.geoapi.temporal.PeriodDuration metadata =
(org.apache.sis.internal.geoapi.temporal.PeriodDuration) this.metadata;
InternationalString value;
BigInteger years = null;
if ((value = metadata.getYears()) != null) {
years = new BigInteger(value.toString());
}
BigInteger months = null;
if ((value = metadata.getMonths()) != null) {
months = new BigInteger(value.toString());
}
BigInteger days = null;
if ((value = metadata.getDays()) != null) {
days = new BigInteger(value.toString());
}
BigInteger hours = null;
if ((value = metadata.getHours()) != null) {
hours = new BigInteger(value.toString());
}
BigInteger minutes = null;
if ((value = metadata.getMinutes()) != null) {
minutes = new BigInteger(value.toString());
}
BigDecimal seconds = null;
if ((value = metadata.getSeconds()) != null) {
seconds = new BigDecimal(value.toString());
}
return factory.newDuration(true, years, months, days, hours, minutes, seconds);
} catch (DatatypeConfigurationException e) {
warningOccured("getElement", e);
}
return null;
}