public static class AdManagerSession.Builder extends Object implements Builder<AdManagerSession>
AdManagerSession
.
Implementation is not thread-safe.
DEFAULT_CONFIGURATION_FILENAME
Constructor and Description |
---|
Builder()
Constructs an empty builder.
|
Modifier and Type | Method and Description |
---|---|
AdManagerSession |
build()
Builds the
AdManagerSession . |
AdManagerSession.ImmutableAdManagerSession |
buildImmutable()
Builds a thread-safe
AdManagerSession.ImmutableAdManagerSession . |
AdManagerSession.Builder |
from(org.apache.commons.configuration.Configuration config)
Reads properties from the provided
Configuration object.Known properties: api.admanager.applicationName api.admanager.networkCode api.admanager.endpoint |
AdManagerSession.Builder |
fromFile()
Loads credentials from the "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
|
AdManagerSession.Builder |
fromFile(File path)
Populates this builder from a properties file from a specified path.
|
AdManagerSession.Builder |
fromFile(String path)
Populates this builder from a properties file from a specified path.
|
AdManagerSession.Builder |
fromFile(URL path)
Populates this builder from a properties file from a specified path.
|
AdManagerSession.Builder |
withApplicationName(String applicationName)
Includes application name (any string of your choice).
|
AdManagerSession.Builder |
withEndpoint(String endpoint)
Override the endpoint server.
|
AdManagerSession.Builder |
withNetworkCode(String networkCode)
Includes network code.
|
AdManagerSession.Builder |
withOAuth2Credential(com.google.api.client.auth.oauth2.Credential oAuth2Credential)
Includes OAuth2 credential to be used for OAuth2 authentication.
|
public Builder()
AdManagerSession
, use AdManagerSession.newBuilder()
instead.public AdManagerSession.Builder fromFile() throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Builder
fromFile
in interface Builder<AdManagerSession>
com.google.api.ads.common.lib.conf.ConfigurationLoadException
- if the configuration could not be
loaded.public AdManagerSession.Builder fromFile(String path) throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Builder
fromFile
in interface Builder<AdManagerSession>
path
- the path to try first as a resource, then as a filecom.google.api.ads.common.lib.conf.ConfigurationLoadException
- if the configuration could not be
loaded.public AdManagerSession.Builder fromFile(File path) throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Builder
fromFile
in interface Builder<AdManagerSession>
path
- the path to load properties fromcom.google.api.ads.common.lib.conf.ConfigurationLoadException
- if the configuration could not be
loaded.public AdManagerSession.Builder fromFile(URL path) throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Builder
fromFile
in interface Builder<AdManagerSession>
path
- the path to try first as a resource, then as a filecom.google.api.ads.common.lib.conf.ConfigurationLoadException
- if the configuration could not be
loaded.public AdManagerSession.Builder from(org.apache.commons.configuration.Configuration config)
Configuration
object.from
in interface Builder<AdManagerSession>
config
- the configurationpublic AdManagerSession.Builder withOAuth2Credential(com.google.api.client.auth.oauth2.Credential oAuth2Credential)
public AdManagerSession.Builder withNetworkCode(String networkCode)
public AdManagerSession.Builder withApplicationName(String applicationName)
public AdManagerSession.Builder withEndpoint(String endpoint)
public AdManagerSession build() throws ValidationException
AdManagerSession
.build
in interface Builder<AdManagerSession>
AdManagerSession
ValidationException
- if the AdManagerSession
did not validatepublic AdManagerSession.ImmutableAdManagerSession buildImmutable() throws ValidationException
AdManagerSession.ImmutableAdManagerSession
.ImmutableAdManagerSession
ValidationException
- if the attributes of this builder fail validationCopyright © 2020. All Rights Reserved.