
at.gridgears.held.internal.parser.CivicAddressParser Maven / Gradle / Ivy
package at.gridgears.held.internal.parser;
import at.gridgears.held.CivicAddress;
import at.gridgears.schemas.held.*;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import static at.gridgears.held.internal.parser.ParseUtils.getStringValue;
final class CivicAddressParser {
List parse(LocationResponseType locationResponseType) {
List result = new LinkedList<>();
ParseUtils.getValue(locationResponseType.getAny(), Presence.class)
.map(Presence::getTuple)
.map(ParseUtils::first)
.map(Tuple::getStatus)
.map(Status::getAny)
.map(ParseUtils::first)
.map(CivicAddressParser::getGeopriv)
.ifPresent(geopriv -> result.addAll(parseCivicAddresses(geopriv)));
return result;
}
private List parseCivicAddresses(Geopriv geopriv) {
List result = new LinkedList<>();
LocInfoType locationInfo = geopriv.getLocationInfo();
if (locationInfo != null) {
result.addAll(parseCivicAddresses(locationInfo.getAny()));
}
return result;
}
private List parseCivicAddresses(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy