public final class ReflectiveBuilder extends Object implements AnalyticsFacade.Builder
| Constructor and Description |
|---|
ReflectiveBuilder(@NotNull String measurementId,
@NotNull String apiSecret) |
| Modifier and Type | Method and Description |
|---|---|
@NotNull AnalyticsFacade |
build()
Creates and returns a new Analytics instance for this Builder.
|
AnalyticsFacade.Builder |
putEventParameter(@NotNull String key,
@NotNull String value)
Associates the provided
value with the provided key in this builder's event parameters. |
AnalyticsFacade.Builder |
putUserProperty(@NotNull String key,
@NotNull String value)
Associates the provided
value with the provided key in this builder's user properties. |
AnalyticsFacade.Builder |
withClientIdFileName(@NotNull String clientIdFileName)
Specifies a custom file name to use when storing a persistent client id
used to identify returning users.
|
AnalyticsFacade.Builder |
withDebugLogger(@NotNull Consumer<? super String> debugLogger)
Specifies a custom logger that will receive debug messages.
|
AnalyticsFacade.Builder |
withErrorLogger(@NotNull Consumer<? super String> errorLogger)
Specifies a custom logger that will receive error messages.
|
AnalyticsFacade.Builder |
withFrequencyLimit(int messages,
long duration,
@NotNull TimeUnit timeUnit)
Limits the frequency by which events can be sent upstream to Google Analytics.
|
AnalyticsFacade.Builder |
withReportDespiteJUnit()
Specifies that reporting shall be made even though
JUnit test classes are available to the classloader.
|
AnalyticsFacade.Builder |
withUrl(@NotNull String url)
Specifies a custom URL to use when connecting to Google Analytics.
|
public AnalyticsFacade.Builder putUserProperty(@NotNull @NotNull String key, @NotNull @NotNull String value)
AnalyticsFacade.Buildervalue with the provided key in this builder's user properties.
If the builder previously contained an association for the key, the old value is replaced
by the provided value.
The key will be used as a Google Analytics "user property" key with the associated value.
putUserProperty in interface AnalyticsFacade.Builderkey - to associatevalue - to associate with the keypublic AnalyticsFacade.Builder putEventParameter(@NotNull @NotNull String key, @NotNull @NotNull String value)
AnalyticsFacade.Buildervalue with the provided key in this builder's event parameters.
If the builder previously contained an association for the key, the old value is replaced
by the provided value.
The key will be used as a Google Analytics "event parameter" key with the associated value.
putEventParameter in interface AnalyticsFacade.Builderkey - to associatevalue - to associate with the keypublic AnalyticsFacade.Builder withFrequencyLimit(int messages, long duration, @NotNull @NotNull TimeUnit timeUnit)
AnalyticsFacade.BuilderEvents that are posted within the provided time limit, counted from the time the last message was successfully attempted upstream, are silently dropped.
Thus, the highest rate of messages sent upstream can be calculated using the
following function <p>
1.0d/timeUnit.toSeconds(duration)
<p>
which yields messages per second.
withFrequencyLimit in interface AnalyticsFacade.Buildermessages - max number of messages to send per durationduration - minimum duration between upstream messages.timeUnit - for the provided duration.public AnalyticsFacade.Builder withErrorLogger(@NotNull @NotNull Consumer<? super String> errorLogger)
AnalyticsFacade.Builder
The default logger is System.err::println, i.e. messages will be
output to the error console.
The actual messages sent to the error logger are unspecified and shall not be acted on by logic.
withErrorLogger in interface AnalyticsFacade.BuildererrorLogger - to use for error messages.public AnalyticsFacade.Builder withDebugLogger(@NotNull @NotNull Consumer<? super String> debugLogger)
AnalyticsFacade.Builder
The default logger is s -> {}, i.e. messages will be
discarded.
The actual messages sent to the debug logger are unspecified and shall not be acted on by logic.
withDebugLogger in interface AnalyticsFacade.BuilderdebugLogger - to use for debug messages.public AnalyticsFacade.Builder withClientIdFileName(@NotNull @NotNull String clientIdFileName)
AnalyticsFacade.BuilderBy default, a file named "chronicle.analytics.client.id" located in the user's home directory will be used.
withClientIdFileName in interface AnalyticsFacade.BuilderclientIdFileName - used to store the persistent client id.public AnalyticsFacade.Builder withUrl(@NotNull @NotNull String url)
AnalyticsFacade.BuilderBy default, the URL "..." will be used.
withUrl in interface AnalyticsFacade.Builderurl - used for remote connectionpublic AnalyticsFacade.Builder withReportDespiteJUnit()
AnalyticsFacade.BuilderBy default, no reporting will be done if either of the classes `org.junit.jupiter.api.Test` or `org.junit.Test` are available to the classloader.
withReportDespiteJUnit in interface AnalyticsFacade.Builder@NotNull public @NotNull AnalyticsFacade build()
AnalyticsFacade.Builderbuild in interface AnalyticsFacade.BuilderCopyright © 2023. All rights reserved.