public GeocodingResult toGeocodingResult ( final GeoServiceGeocodingResult gsResult ) { if ( gsResult == null ) { return null ; } final GeocodingResult result = new GeocodingResult ( ) ; final AddressComponent [ ] addressComponents = gsResult . getAddressComponents ( ) ; if ( addressComponents == null ) { result . addressComponents = null ; } else { result . addressComponents = new AddressComponent [ addressComponents . length ] ; for ( int i = 0 ; i < addressComponents . length ; i ++ ) { result . addressComponents [ i ] = copy ( addressComponents [ i ] ) ; } } result . formattedAddress = gsResult . getFormattedAddress ( ) ; result . geometry = toGeometry ( gsResult . getGeometry ( ) ) ; result . partialMatch = gsResult . isPartialMatch ( ) ; result . placeId = gsResult . getPlaceId ( ) ; // This is safe because the gs object returns a copy of its array. result . postcodeLocalities = gsResult . getPostcodeLocalities ( ) ; // This is safe because the gs object returns a copy of its array. result . types = gsResult . getTypes ( ) ; return result ; }
Create a GeocodingResult from a GeoServiceGeocodingResult .