类javax.annotation.ParametersAreNullableByDefault源码实例Demo

下面列出了怎么用javax.annotation.ParametersAreNullableByDefault的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: kork   文件: ExpectedArtifact.java
@Builder(toBuilder = true)
@ParametersAreNullableByDefault
private ExpectedArtifact(
    Artifact matchArtifact,
    boolean usePriorArtifact,
    boolean useDefaultArtifact,
    Artifact defaultArtifact,
    String id,
    Artifact boundArtifact) {
  this.matchArtifact =
      Optional.ofNullable(matchArtifact).orElseGet(() -> Artifact.builder().build());
  this.usePriorArtifact = usePriorArtifact;
  this.useDefaultArtifact = useDefaultArtifact;
  this.defaultArtifact = defaultArtifact;
  this.id = Strings.nullToEmpty(id);
  this.boundArtifact = boundArtifact;
}
 
@JsonCreator
@ParametersAreNullableByDefault
BrowserSourceConfiguration(@JsonProperty(defaultValue=DEFAULT_PREFIX) final String prefix,
                           @JsonProperty(defaultValue=DEFAULT_EVENT_SUFFIX) final String eventSuffix,
                           @Nonnull final Optional<String> cookieDomain,
                           @JsonProperty(defaultValue=DEFAULT_PARTY_COOKIE) final String partyCookie,
                           @JsonProperty(defaultValue=DEFAULT_PARTY_TIMEOUT) final Duration partyTimeout,
                           @JsonProperty(defaultValue=DEFAULT_SESSION_COOKIE) final String sessionCookie,
                           @JsonProperty(defaultValue=DEFAULT_SESSION_TIMEOUT) final Duration sessionTimeout,
                           @JsonProperty(defaultValue=DEFAULT_HTTP_RESPONSE_DELAY) final Duration httpResponseDelay,
                           final JavascriptConfiguration javascript) {
    // TODO: register a custom deserializer with Jackson that uses the defaultValue property from the annotation to fix this
    this.prefix = Optional.ofNullable(prefix).map(BrowserSourceConfiguration::ensureTrailingSlash).orElse(DEFAULT_PREFIX);
    this.eventSuffix = Optional.ofNullable(eventSuffix).orElse(DEFAULT_EVENT_SUFFIX);
    this.cookieDomain = Objects.requireNonNull(cookieDomain);
    this.partyCookie = Optional.ofNullable(partyCookie).orElse(DEFAULT_PARTY_COOKIE);
    this.partyTimeout = Optional.ofNullable(partyTimeout).orElseGet(() -> DurationDeserializer.parseDuration(DEFAULT_PARTY_TIMEOUT));
    this.sessionCookie = Optional.ofNullable(sessionCookie).orElse(DEFAULT_SESSION_COOKIE);
    this.sessionTimeout = Optional.ofNullable(sessionTimeout).orElseGet(() -> DurationDeserializer.parseDuration(DEFAULT_SESSION_TIMEOUT));
    this.httpResponseDelay = Optional.ofNullable(httpResponseDelay).orElseGet(() -> DurationDeserializer.parseDuration(DEFAULT_HTTP_RESPONSE_DELAY));
    this.javascript = Optional.ofNullable(javascript).orElse(JavascriptConfiguration.DEFAULT_JAVASCRIPT_CONFIGURATION);
}
 
@JsonCreator
@ParametersAreNullableByDefault
public GoogleCloudStorageRetryConfiguration(final Integer maxAttempts,
                                            final Duration totalTimeout,
                                            final Duration initialRetryDelay,
                                            final Double retryDelayMultiplier,
                                            final Duration maxRetryDelay,
                                            final Double jitterFactor,
                                            final Duration jitterDelay) {
    super(Optional.ofNullable(maxAttempts).orElse(DEFAULT_MAX_ATTEMPTS),
          Optional.ofNullable(totalTimeout).orElse(DEFAULT_TOTAL_TIMEOUT),
          Optional.ofNullable(initialRetryDelay).orElse(DEFAULT_INITIAL_RETRY_DELAY),
          Optional.ofNullable(retryDelayMultiplier).orElse(DEFAULT_RETRY_DELAY_MULTIPLIER),
          Optional.ofNullable(maxRetryDelay).orElse(DEFAULT_MAX_RETRY_DELAY));
    this.jitterFactor = Optional.ofNullable(jitterFactor);
    // The default jitter delay only applies if neither a duration nor a factor were specified.
    this.jitterDelay = null != jitterDelay
        ? Optional.of(jitterDelay)
        : this.jitterFactor.isPresent() ? Optional.empty() : DEFAULT_JITTER_DURATION;
}
 
@JsonCreator
@ParametersAreNullableByDefault
public GooglePubSubRetryConfiguration(final Integer maxAttempts,
                                      final Duration totalTimeout,
                                      final Duration initialRetryDelay,
                                      final Double retryDelayMultiplier,
                                      final Duration maxRetryDelay,
                                      final Duration initialRpcTimeout,
                                      final Double rpcTimeoutMultiplier,
                                      final Duration maxRpcTimeout) {
    super(Optional.ofNullable(maxAttempts).orElse(DEFAULT_MAX_ATTEMPTS),
          Optional.ofNullable(totalTimeout).orElse(DEFAULT_TOTAL_TIMEOUT),
          Optional.ofNullable(initialRetryDelay).orElse(DEFAULT_INITIAL_RETRY_DELAY),
          Optional.ofNullable(retryDelayMultiplier).orElse(DEFAULT_RETRY_DELAY_MULTIPLIER),
          Optional.ofNullable(maxRetryDelay).orElse(DEFAULT_MAX_RETRY_DELAY));
    this.initialRpcTimeout = Optional.ofNullable(initialRpcTimeout).orElse(DEFAULT_INITIAL_RPC_TIMEOUT);
    this.rpcTimeoutMultiplier = Optional.ofNullable(rpcTimeoutMultiplier).orElse(DEFAULT_RPC_TIMEOUT_MULTIPLIER);
    this.maxRpcTimeout = Optional.ofNullable(maxRpcTimeout).orElse(this.initialRpcTimeout);
}
 
@JsonCreator
@ParametersAreNullableByDefault
JavascriptConfiguration(@JsonProperty(defaultValue=DEFAULT_NAME) final String name,
                        @JsonProperty(defaultValue=DEFAULT_LOGGING) final Boolean logging,
                        @JsonProperty(defaultValue=DEFAULT_DEBUG) final Boolean debug,
                        @JsonProperty(defaultValue=DEFAULT_AUTO_PAGE_VIEW_EVENT) final Boolean autoPageViewEvent,
                        @JsonProperty(defaultValue=DEFAULT_EVENT_TIMEOUT) final Duration eventTimeout) {
    // TODO: register a custom deserializer with Jackson that uses the defaultValue property from the annotation to fix this
    this.name = Optional.ofNullable(name).orElse(DEFAULT_NAME);
    this.logging = Optional.ofNullable(logging).orElseGet(() -> Boolean.valueOf(DEFAULT_LOGGING));
    this.debug = Optional.ofNullable(debug).orElseGet(() -> Boolean.valueOf(DEFAULT_DEBUG));
    this.autoPageViewEvent = Optional.ofNullable(autoPageViewEvent).orElseGet(() -> Boolean.valueOf(DEFAULT_AUTO_PAGE_VIEW_EVENT));
    this.eventTimeout = Optional.ofNullable(eventTimeout).orElseGet(() -> DurationDeserializer.parseDuration(DEFAULT_EVENT_TIMEOUT));
}
 
@JsonCreator
@ParametersAreNullableByDefault
KafkaSinkConfiguration(@JsonProperty(defaultValue=DEFAULT_TOPIC) final String topic,
                       @JsonProperty final KafkaSinkMode mode) {
    // TODO: register a custom deserializer with Jackson that uses the defaultValue property from the annotation to fix this
    super(topic);
    this.mode = Optional.ofNullable(mode).orElse(DEFAULT_SINK_MODE);
}
 
@JsonCreator
@ParametersAreNullableByDefault
GoogleCloudPubSubSinkConfiguration(@JsonProperty(defaultValue=DEFAULT_TOPIC) final String topic,
                                   final GooglePubSubRetryConfiguration retrySettings,
                                   final GoogleBatchingConfiguration batchingSettings) {
    super(topic);
    this.retrySettings = Optional.ofNullable(retrySettings).orElse(DEFAULT_RETRY_SETTINGS);
    this.batchingSettings = Optional.ofNullable(batchingSettings).orElse(DEFAULT_BATCHING_SETTINGS);
}
 
源代码8 项目: divolte-collector   文件: HdfsSinkConfiguration.java
@JsonCreator
@ParametersAreNullableByDefault
HdfsSinkConfiguration(@JsonProperty(defaultValue=DEFAULT_REPLICATION) final Short replication,
                      final FileStrategyConfiguration fileStrategy) {
    super(fileStrategy);
    // TODO: register a custom deserializer with Jackson that uses the defaultValue property from the annotation to fix this
    this.replication = Optional.ofNullable(replication).orElseGet(() -> Short.valueOf(DEFAULT_REPLICATION));
}
 
@JsonCreator
@ParametersAreNullableByDefault
public GoogleBatchingConfiguration(final Long elementCountThreshold,
                                   final Long requestBytesThreshold,
                                   final Duration delayThreshold) {
    this.elementCountThreshold = Optional.ofNullable(elementCountThreshold).orElse(DEFAULT_ELEMENT_COUNT_THRESHOLD);
    this.requestBytesThreshold = Optional.ofNullable(requestBytesThreshold).orElse(DEFAULT_REQUEST_BYTES_THRESHOLD);
    this.delayThreshold = Optional.ofNullable(delayThreshold).orElse(DEFAULT_DELAY_THRESHOLD);
}
 
@JsonCreator
@ParametersAreNullableByDefault
JsonSourceConfiguration(
        @JsonProperty(defaultValue=DEFAULT_EVENT_PATH) final String eventPath,
        @JsonProperty(defaultValue=DEFAULT_PARTY_ID_PARAMETER) final String partyIdParameter,
        @JsonProperty(defaultValue=DEFAULT_MAXIMUM_BODY_SIZE) final Integer maximumBodySize) {
    // TODO: register a custom deserializer with Jackson that uses the defaultValue property from the annotation to fix this
    this.eventPath = Optional.ofNullable(eventPath).orElse(DEFAULT_EVENT_PATH);
    this.partyIdParameter = Optional.ofNullable(partyIdParameter).orElse(DEFAULT_PARTY_ID_PARAMETER);
    this.maximumBodySize = Optional.ofNullable(maximumBodySize).orElseGet(() -> Integer.valueOf(DEFAULT_MAXIMUM_BODY_SIZE));
}
 
@JsonCreator
@ParametersAreNullableByDefault
FileStrategyConfiguration(@JsonProperty(defaultValue=DEFAULT_ROLL_EVERY) final Duration rollEvery,
                          @JsonProperty(defaultValue=DEFAULT_SYNC_FILE_AFTER_RECORDS) final Integer syncFileAfterRecords,
                          @JsonProperty(defaultValue=DEFAULT_SYNC_FILE_AFTER_DURATION) final Duration syncFileAfterDuration,
                          @JsonProperty(defaultValue=DEFAULT_WORKING_DIR) final String workingDir,
                          @JsonProperty(defaultValue=DEFAULT_PUBLISH_DIR) final String publishDir) {
    // TODO: register a custom deserializer with Jackson that uses the defaultValue property from the annotation to fix this
    this.rollEvery = Optional.ofNullable(rollEvery).orElseGet(() -> DurationDeserializer.parseDuration(DEFAULT_ROLL_EVERY));
    this.syncFileAfterRecords = Optional.ofNullable(syncFileAfterRecords).orElseGet(() -> Integer.valueOf(DEFAULT_SYNC_FILE_AFTER_RECORDS));
    this.syncFileAfterDuration = Optional.ofNullable(syncFileAfterDuration).orElseGet(() -> DurationDeserializer.parseDuration(DEFAULT_SYNC_FILE_AFTER_DURATION));
    this.workingDir = Optional.ofNullable(workingDir).orElse(DEFAULT_WORKING_DIR);
    this.publishDir = Optional.ofNullable(publishDir).orElse(DEFAULT_PUBLISH_DIR);
}
 
源代码12 项目: divolte-collector   文件: TopicSinkConfiguration.java
@JsonCreator
@ParametersAreNullableByDefault
TopicSinkConfiguration(final String topic) {
    this.topic = Optional.ofNullable(topic).orElse(DEFAULT_TOPIC);
}
 
源代码13 项目: divolte-collector   文件: FileSinkConfiguration.java
@ParametersAreNullableByDefault
public FileSinkConfiguration(final FileStrategyConfiguration fileStrategy) {
    this.fileStrategy = Optional.ofNullable(fileStrategy).orElse(FileStrategyConfiguration.DEFAULT_FILE_STRATEGY_CONFIGURATION);
}
 
 类所在包
 类方法
 同包方法