org.axonframework.common.Assert.nonNull()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.axonframework.common.Assert.nonNull()方法的一些代码示例,展示了Assert.nonNull()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.nonNull()方法的具体详情如下:
包路径:org.axonframework.common.Assert
类名称:Assert
方法名:nonNull

Assert.nonNull介绍

[英]Assert that the given value is not null. If not, an IllegalArgumentException is thrown.
[中]断言给定的值不为null。如果不是,则抛出IllegalArgumentException。

代码示例

代码示例来源:origin: AxonFramework/AxonFramework

/**
 * Instantiate a lazy {@link ScopeAwareProvider} with the given {@code configuration} parameter.
 *
 * @param configuration a {@link Configuration} used to retrieve {@link ScopeAware} components from
 * @throws IllegalArgumentException when {@code configuration} is {@code null}
 */
public ConfigurationScopeAwareProvider(Configuration configuration) {
  this.configuration = Assert.nonNull(configuration, () -> "configuration may not be null");
}

代码示例来源:origin: org.axonframework/axon-core

/**
 * Instantiate a lazy {@link ScopeAwareProvider} with the given {@code configuration} parameter.
 *
 * @param configuration a {@link Configuration} used to retrieve {@link ScopeAware} components from
 * @throws IllegalArgumentException when {@code configuration} is {@code null}
 */
public ConfigurationScopeAwareProvider(Configuration configuration) {
  this.configuration = Assert.nonNull(configuration, () -> "configuration may not be null");
}

代码示例来源:origin: org.axonframework/axon-configuration

/**
 * Instantiate a lazy {@link ScopeAwareProvider} with the given {@code configuration} parameter.
 *
 * @param configuration a {@link Configuration} used to retrieve {@link ScopeAware} components from
 * @throws IllegalArgumentException when {@code configuration} is {@code null}
 */
public ConfigurationScopeAwareProvider(Configuration configuration) {
  this.configuration = Assert.nonNull(configuration, () -> "configuration may not be null");
}

代码示例来源:origin: org.axonframework/axon-kafka

public FetchEventsTask(Consumer<K, V> consumer, KafkaTrackingToken token,
            Buffer<KafkaEventMessage> buffer,
            KafkaMessageConverter<K, V> converter,
            BiFunction<ConsumerRecord<K, V>, KafkaTrackingToken, Void> callback,
            long timeout,
            java.util.function.Consumer<FetchEventsTask> closeHandler) {
  Assert.isFalse(timeout < 0, () -> "Timeout may not be < 0");
  this.consumer = nonNull(consumer, () -> "Consumer may not be null");
  this.currentToken = nonNull(token, () -> "Token may not be null");
  this.buffer = nonNull(buffer, () -> "Buffer may not be null");
  this.converter = nonNull(converter, () -> "Converter may not be null");
  this.callback = nonNull(callback, () -> "Callback may not be null");
  this.timeout = timeout;
  this.closeHandler = getOrDefault(closeHandler, x -> {});
}

代码示例来源:origin: org.axonframework/axon-core

/**
 * Initializes a repository that stores aggregate of the given {@code aggregateType}. All aggregates in this
 * repository must be {@code instanceOf} this aggregate type.
 *
 * @param aggregateType            The type of aggregate stored in this repository
 * @param parameterResolverFactory The parameter resolver factory used to resolve parameters of annotated handlers
 */
protected AbstractRepository(Class<T> aggregateType, ParameterResolverFactory parameterResolverFactory) {
  this(AnnotatedAggregateMetaModelFactory.inspectAggregate(
      nonNull(aggregateType, () -> "aggregateType may not be null"),
      nonNull(parameterResolverFactory, () -> "parameterResolverFactory may not be null")
  ));
}

代码示例来源:origin: org.axonframework/axon-core

/**
 * Initializes a repository that stores aggregate of the given {@code aggregateType}. All aggregates in this
 * repository must be {@code instanceOf} this aggregate type.
 *
 * @param aggregateType            The type of aggregate stored in this repository
 * @param parameterResolverFactory The parameter resolver factory used to resolve parameters of annotated handlers
 * @param handlerDefinition        The handler definition used to create concrete handlers
 */
protected AbstractRepository(Class<T> aggregateType, ParameterResolverFactory parameterResolverFactory,
               HandlerDefinition handlerDefinition) {
  this(AnnotatedAggregateMetaModelFactory
         .inspectAggregate(nonNull(aggregateType, () -> "aggregateType may not be null"),
                  nonNull(parameterResolverFactory,
                      () -> "parameterResolverFactory may not be null"),
                  nonNull(handlerDefinition, () -> "handler definition may not be null")));
}

代码示例来源:origin: org.axonframework.extensions.kafka/axon-kafka

public FetchEventsTask(Consumer<K, V> consumer, KafkaTrackingToken token,
            Buffer<KafkaEventMessage> buffer,
            KafkaMessageConverter<K, V> converter,
            BiFunction<ConsumerRecord<K, V>, KafkaTrackingToken, Void> callback,
            long timeout,
            java.util.function.Consumer<FetchEventsTask> closeHandler) {
  Assert.isFalse(timeout < 0, () -> "Timeout may not be < 0");
  this.consumer = nonNull(consumer, () -> "Consumer may not be null");
  this.currentToken = nonNull(token, () -> "Token may not be null");
  this.buffer = nonNull(buffer, () -> "Buffer may not be null");
  this.converter = nonNull(converter, () -> "Converter may not be null");
  this.callback = nonNull(callback, () -> "Callback may not be null");
  this.timeout = timeout;
  this.closeHandler = getOrDefault(closeHandler, x -> {});
}

代码示例来源:origin: org.axonframework/axon-core

/**
 * Initializes a repository that stores aggregate of the given {@code aggregateType}. All aggregates in this
 * repository must be {@code instanceOf} this aggregate type.
 *
 * @param aggregateType The type of aggregate stored in this repository
 */
protected AbstractRepository(Class<T> aggregateType) {
  this(AnnotatedAggregateMetaModelFactory.inspectAggregate(
      nonNull(aggregateType, () -> "aggregateType may not be null")
  ));
}

相关文章

微信公众号

最新文章

更多