com.google.api.ads.common.lib.utils
Interface Builder<T>

Type Parameters:
T - the builder type
All Known Implementing Classes:
AdWordsSession.Builder, ClientLoginTokens.ForApiBuilder, DfaSession.Builder, DfpSession.Builder, FactoryConfiguration.Builder

public interface Builder<T>

Builder interface.

Author:
Adam Rogal

Field Summary
static String DEFAULT_CONFIGURATION_FILENAME
           
 
Method Summary
 T build()
          Constructs this object.
 Builder<T> from(org.apache.commons.configuration.Configuration config)
          Populates this builder from the specified Configuration.
 Builder<T> fromFile()
          Loads credentials from "ads.properties" file in one of the following locations according to the following order: in the current directory, in the user home directory, in the classpath
 Builder<T> fromFile(File path)
          Populates this builder from a properties file from a specified path.
 Builder<T> fromFile(String path)
          Populates this builder from a properties file from a specified path.
 Builder<T> fromFile(URL path)
          Populates this builder from a properties file from a specified path.
 

Field Detail

DEFAULT_CONFIGURATION_FILENAME

static final String DEFAULT_CONFIGURATION_FILENAME
See Also:
Constant Field Values
Method Detail

build

T build()
        throws ValidationException
Constructs this object.

Throws:
ValidationException - if the provided data is not valid.

from

Builder<T> from(org.apache.commons.configuration.Configuration config)
                throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Populates this builder from the specified Configuration.

Parameters:
config - Configuration to load properties from
Returns:
Builder populated from the Configuration
Throws:
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be loaded.

fromFile

Builder<T> fromFile()
                    throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Loads credentials from "ads.properties" file in one of the following locations according to the following order: in the current directory, in the user home directory, in the classpath

Throws:
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be loaded.

fromFile

Builder<T> fromFile(String path)
                    throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Populates this builder from a properties file from a specified path. If not absolute, will look in user home directory, the current classpath and the system classpath.

Parameters:
path - the path to try first as a resource, then as a file
Returns:
Builder populated with properties.
Throws:
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be loaded.

fromFile

Builder<T> fromFile(File path)
                    throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Populates this builder from a properties file from a specified path.

Parameters:
path - the path to load properties from
Returns:
Builder populated with properties.
Throws:
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be loaded.

fromFile

Builder<T> fromFile(URL path)
                    throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Populates this builder from a properties file from a specified path. If not absolute, will look in user home directory, the current classpath and the system classpath.

Parameters:
path - the path to try first as a resource, then as a file
Returns:
Builder populated with properties.
Throws:
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be loaded.


Copyright © 2012. All Rights Reserved.