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