本文整理了Java中org.axonframework.common.Assert.isFalse()
方法的一些代码示例,展示了Assert.isFalse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.isFalse()
方法的具体详情如下:
包路径:org.axonframework.common.Assert
类名称:Assert
方法名:isFalse
[英]Asserts that the given expression is false. If not, an IllegalArgumentException is thrown.
[中]断言给定的表达式为false。如果不是,则抛出IllegalArgumentException。
代码示例来源:origin: AxonFramework/AxonFramework
private void assertNotBuilt() {
Assert.isFalse(built, () -> "this builder has already been built");
}
}
代码示例来源:origin: AxonFramework/AxonFramework
/**
* Initializes a BatchingUnitOfWork for processing the given list of {@code messages}.
*
* @param messages batch of messages to process
*/
public BatchingUnitOfWork(List<T> messages) {
Assert.isFalse(messages.isEmpty(), () -> "The list of Messages to process is empty");
processingContexts = messages.stream().map(MessageProcessingContext::new).collect(Collectors.toList());
processingContext = processingContexts.get(0);
}
代码示例来源:origin: AxonFramework/AxonFramework
/**
* Initialize the AggregateFactory for creating instances of the given {@code aggregateType}.
*
* @param aggregateType The type of aggregate this factory creates instances of.
* @throws IncompatibleAggregateException if the aggregate constructor throws an exception, or if the JVM security
* settings prevent the GenericAggregateFactory from calling the
* constructor.
*/
public GenericAggregateFactory(Class<T> aggregateType) {
super(aggregateType);
Assert.isFalse(Modifier.isAbstract(aggregateType.getModifiers()), () -> "Given aggregateType may not be abstract");
try {
this.constructor = ensureAccessible(aggregateType.getDeclaredConstructor());
} catch (NoSuchMethodException e) {
throw new IncompatibleAggregateException(format("The aggregate [%s] doesn't provide a no-arg constructor.",
aggregateType.getSimpleName()), e);
}
}
代码示例来源:origin: org.axonframework/axon-core
private void assertNotBuilt() {
Assert.isFalse(built, () -> "this builder has already been built");
}
}
代码示例来源:origin: org.axonframework/axon-configuration
private void assertNotBuilt() {
Assert.isFalse(built, () -> "this builder has already been built");
}
}
代码示例来源:origin: org.axonframework/axon-core
/**
* Initializes a BatchingUnitOfWork for processing the given list of {@code messages}.
*
* @param messages batch of messages to process
*/
public BatchingUnitOfWork(List<T> messages) {
Assert.isFalse(messages.isEmpty(), () -> "The list of Messages to process is empty");
processingContexts = messages.stream().map(MessageProcessingContext::new).collect(Collectors.toList());
processingContext = processingContexts.get(0);
}
代码示例来源:origin: org.axonframework/axon-messaging
/**
* Initializes a BatchingUnitOfWork for processing the given list of {@code messages}.
*
* @param messages batch of messages to process
*/
public BatchingUnitOfWork(List<T> messages) {
Assert.isFalse(messages.isEmpty(), () -> "The list of Messages to process is empty");
processingContexts = messages.stream().map(MessageProcessingContext::new).collect(Collectors.toList());
processingContext = processingContexts.get(0);
}
代码示例来源:origin: org.axonframework.extensions.mongo/axon-mongo
/**
* Sets the value of this node. Note that a node can contain either a value, or child nodes
*
* @param value The value to set for this node
*/
public void setValue(String value) {
Assert.isFalse(children().hasNext(),
() -> "A child node was already present. " + "A node cannot contain a value as well as child nodes.");
this.value = value;
}
代码示例来源:origin: org.axonframework/axon-mongo
/**
* Sets the value of this node. Note that a node can contain either a value, or child nodes
*
* @param value The value to set for this node
*/
public void setValue(String value) {
Assert.isFalse(children().hasNext(),
() -> "A child node was already present. " + "A node cannot contain a value as well as child nodes.");
this.value = value;
}
代码示例来源:origin: org.axonframework/axon-core
/**
* Initialize the AggregateFactory for creating instances of the given {@code aggregateType}.
*
* @param aggregateType The type of aggregate this factory creates instances of.
* @throws IncompatibleAggregateException if the aggregate constructor throws an exception, or if the JVM security
* settings prevent the GenericAggregateFactory from calling the
* constructor.
*/
public GenericAggregateFactory(Class<T> aggregateType) {
super(aggregateType);
Assert.isFalse(Modifier.isAbstract(aggregateType.getModifiers()), () -> "Given aggregateType may not be abstract");
try {
this.constructor = ensureAccessible(aggregateType.getDeclaredConstructor());
} catch (NoSuchMethodException e) {
throw new IncompatibleAggregateException(format("The aggregate [%s] doesn't provide a no-arg constructor.",
aggregateType.getSimpleName()), e);
}
}
代码示例来源:origin: org.axonframework/axon-eventsourcing
/**
* Initialize the AggregateFactory for creating instances of the given {@code aggregateType}.
*
* @param aggregateType The type of aggregate this factory creates instances of.
* @throws IncompatibleAggregateException if the aggregate constructor throws an exception, or if the JVM security
* settings prevent the GenericAggregateFactory from calling the
* constructor.
*/
public GenericAggregateFactory(Class<T> aggregateType) {
super(aggregateType);
Assert.isFalse(Modifier.isAbstract(aggregateType.getModifiers()), () -> "Given aggregateType may not be abstract");
try {
this.constructor = ensureAccessible(aggregateType.getDeclaredConstructor());
} catch (NoSuchMethodException e) {
throw new IncompatibleAggregateException(format("The aggregate [%s] doesn't provide a no-arg constructor.",
aggregateType.getSimpleName()), e);
}
}
代码示例来源:origin: org.axonframework/axon-mongo
/**
* Adds a child node to the current node. Note that the name of a child node must not be {@code null} and may
* not start with "attr_", in order to differentiate between child nodes and attributes.
*
* @param name The name of the child node
* @return A BSONNode representing the newly created child node.
*/
public BSONNode addChildNode(String name) {
Assert.isTrue(value == null,
() -> "A value was already present." + "A node cannot contain a value as well as child nodes");
Assert.notNull(name, () -> "Node name must not be null");
Assert.isFalse(name.startsWith(ATTRIBUTE_PREFIX), () -> "Node names may not start with '" + ATTRIBUTE_PREFIX + "'");
return addChild(name, null);
}
代码示例来源:origin: org.axonframework.extensions.mongo/axon-mongo
/**
* Adds a child node to the current node. Note that the name of a child node must not be {@code null} and may
* not start with "attr_", in order to differentiate between child nodes and attributes.
*
* @param name The name of the child node
* @return A BSONNode representing the newly created child node.
*/
public BSONNode addChildNode(String name) {
Assert.isTrue(value == null,
() -> "A value was already present." + "A node cannot contain a value as well as child nodes");
Assert.notNull(name, () -> "Node name must not be null");
Assert.isFalse(name.startsWith(ATTRIBUTE_PREFIX), () -> "Node names may not start with '" + ATTRIBUTE_PREFIX + "'");
return addChild(name, null);
}
代码示例来源:origin: org.axonframework/axon-core
/**
* Initialize the BackoffParameters using given parameters.
*
* @param acquireAttempts the total number of attempts to make to acquire the lock. A value of {@code -1} means indefinite attempts
* @param maximumQueued the threshold of the number of threads queued for acquiring the lock, or {@code -1} to ignore queue size
* @param lockAttemptTimeout the amount of time to wait, in milliseconds, for each lock acquisition attempt
*/
public BackoffParameters(int acquireAttempts, int maximumQueued, int lockAttemptTimeout) {
Assert.isTrue(
acquireAttempts > 0 || acquireAttempts == -1,
() -> "acquireAttempts needs to be a positive integer or -1, but was '" + acquireAttempts + "'"
);
this.acquireAttempts = acquireAttempts;
Assert.isTrue(
maximumQueued > 0 || maximumQueued == -1,
() -> "maximumQueued needs to be a positive integer or -1, but was '" + maximumQueued + "'"
);
this.maximumQueued = maximumQueued;
Assert.isFalse(
lockAttemptTimeout < 0,
() -> "lockAttemptTimeout needs to be a non negative integer, but was '" + lockAttemptTimeout + "'"
);
this.lockAttemptTimeout = lockAttemptTimeout;
}
代码示例来源:origin: vvgomes/event-driven-restaurant
@CommandHandler
public MenuItem(AddMenuItemCommand command) {
Assert.isFalse(command.getDescription().isEmpty(), () -> "Description must be present.");
apply(new MenuItemAddedEvent(command.getId(), command.getDescription(), command.getPrice()));
}
代码示例来源:origin: vvgomes/event-driven-restaurant
@CommandHandler
public void handle(ModifyMenuItemCommand command) {
Assert.state(active, () -> "Item is inactive.");
Assert.isFalse(command.getDescription().isEmpty(), () -> "Description must be present.");
apply(new MenuItemModifiedEvent(id, command.getDescription(), command.getPrice()));
}
代码示例来源: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.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 -> {});
}
内容来源于网络,如有侵权,请联系作者删除!