Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 // Copyright 2012 Google Inc. All Rights Reserved.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
 //       http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.api.ads.adwords.axis.utility.extension.delegates;
Specific AbstractBaseDelegate for com.google.api.ads.adwords.axis.v201309.cm.GeoLocationServiceInterface.

Author(s):
Julian Toledo
Default Constructor.

Parameters:
adWordsSession the adWordsSession to use with the delegate/service
  public GeoLocationDelegate(AdWordsSession adWordsSession) {
    super(adWordsSessionGeoLocationServiceInterface.class);
  }

  
Constructor with custom service.

Parameters:
adWordsSession the adWordsSession to use with the delegate/service
service the custom service class for the SOAP service
  public GeoLocationDelegate(AdWordsSession adWordsSessionGeoLocationServiceInterface service) {
    super(adWordsSessionservice);
  }

  
Retrieves the GeoLocations for the list of addresses.

Parameters:
addresses list of addresses Address
Returns:
the list of GeoLocations matching the addresses
Throws:
java.rmi.RemoteException for communication-related exceptions
  public List<GeoLocationgetGeoLocation(List<Addressaddressesthrows RemoteException {
    GeoLocationSelector geoLocationSelector = new GeoLocationSelector();
    geoLocationSelector.setAddresses(addresses.toArray((new Address[] {})));
    return Arrays.asList(getService().get(geoLocationSelector));
  }

  
Retrieves the GeoLocations for an addresses.

Parameters:
address a single Address
Returns:
a single GeoLocation matching the addresses
Throws:
com.google.api.ads.adwords.axis.utility.extension.exception.UtilityLibraryException if result is empty
java.rmi.RemoteException for communication-related exceptions
  public GeoLocation getGeoLocation(Address addressthrows RemoteException {
    GeoLocationSelector geoLocationSelector = new GeoLocationSelector();
    geoLocationSelector.setAddresses(new Address[]{address});
    GeoLocation[] array = getService().get(geoLocationSelector);
    if (array != null && array.length > 0) {
      return array[0];
    } else {
      throw new UtilityLibraryException("Error: result empty for getGeoLocation");
    }
  }
New to GrepCode? Check out our FAQ X