org.springframework.util.Assert.noNullElements()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(596)

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

Assert.noNullElements介绍

[英]Assert that an array has no null elements. Note: Does not complain if the array is empty!

Assert.noNullElements(array);

[中]断言数组没有空元素。注意:如果阵列为空,则不会抱怨

Assert.noNullElements(array);

代码示例

代码示例来源:origin: spring-projects/spring-framework

private void assertContentsOfScriptArray(Resource... scripts) {
  Assert.notNull(scripts, "Scripts array must not be null");
  Assert.noNullElements(scripts, "Scripts array must not contain null elements");
}

代码示例来源:origin: codecentric/spring-boot-admin

public ChainingStrategy(EndpointDetectionStrategy... delegates) {
  Assert.notNull(delegates, "'delegates' must not be null.");
  Assert.noNullElements(delegates, "'delegates' must not contain null.");
  this.delegates = delegates;
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Create a {@code FilterChain} with Filter's and a Servlet.
 * @param servlet the {@link Servlet} to invoke in this {@link FilterChain}
 * @param filters the {@link Filter}'s to invoke in this {@link FilterChain}
 * @since 3.2
 */
public MockFilterChain(Servlet servlet, Filter... filters) {
  Assert.notNull(filters, "filters cannot be null");
  Assert.noNullElements(filters, "filters cannot contain null values");
  this.filters = initFilterList(servlet, filters);
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Private constructor, not for direct instantiation.
 * @see org.springframework.test.web.servlet.setup.MockMvcBuilders
 */
MockMvc(TestDispatcherServlet servlet, Filter... filters) {
  Assert.notNull(servlet, "DispatcherServlet is required");
  Assert.notNull(filters, "Filters cannot be null");
  Assert.noNullElements(filters, "Filters cannot contain null values");
  this.servlet = servlet;
  this.filters = filters;
  this.servletContext = servlet.getServletContext();
}

代码示例来源:origin: codecentric/spring-boot-admin

public ProbeEndpointsStrategy(InstanceWebClient instanceWebClient, String[] endpoints) {
  Assert.notNull(endpoints, "'endpoints' must not be null.");
  Assert.noNullElements(endpoints, "'endpoints' must not contain null.");
  this.endpoints = Arrays.stream(endpoints).map(EndpointDefinition::create).collect(Collectors.toList());
  this.instanceWebClient = instanceWebClient;
}

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
public ConnectFromBuilder startWith(AggregationExpression... expressions) {
  Assert.notNull(expressions, "AggregationExpressions must not be null!");
  Assert.noNullElements(expressions, "AggregationExpressions must not contain null elements!");
  this.startWith = Arrays.asList(expressions);
  return this;
}

代码示例来源:origin: spring-projects/spring-data-mongodb

private Criteria positions(String operator, List<Integer> positions) {
  Assert.notNull(positions, "Positions must not be null!");
  Assert.noNullElements(positions.toArray(), "Positions must not contain null values.");
  target.criteria.put(operator, positions);
  return target;
}

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

/**
 * Create a {@code FilterChain} with Filter's and a Servlet.
 * @param servlet the {@link Servlet} to invoke in this {@link FilterChain}
 * @param filters the {@link Filter}'s to invoke in this {@link FilterChain}
 * @since 3.2
 */
public MockFilterChain(Servlet servlet, Filter... filters) {
  Assert.notNull(filters, "filters cannot be null");
  Assert.noNullElements(filters, "filters cannot contain null values");
  this.filters = initFilterList(servlet, filters);
}

代码示例来源:origin: spring-projects/spring-data-mongodb

/**
 * Creates a criterion using the {@literal $type} operator.
 *
 * @param types must not be {@literal null}.
 * @return this
 * @since 2.1
 * @see <a href="https://docs.mongodb.com/manual/reference/operator/query/type/">MongoDB Query operator: $type</a>
 */
public Criteria type(Type... types) {
  Assert.notNull(types, "Types must not be null!");
  Assert.noNullElements(types, "Types must not contain null.");
  criteria.put("$type", Arrays.asList(types).stream().map(Type::value).collect(Collectors.toList()));
  return this;
}

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
public ConnectFromBuilder startWith(Object... expressions) {
  Assert.notNull(expressions, "Expressions must not be null!");
  Assert.noNullElements(expressions, "Expressions must not contain null elements!");
  this.startWith = verifyAndPotentiallyTransformStartsWithTypes(expressions);
  return this;
}

代码示例来源:origin: spring-projects/spring-data-jpa

/**
 * Creates new unsafe {@link JpaSort} based on given {@link Direction} and properties.
 *
 * @param direction must not be {@literal null}.
 * @param properties must not be {@literal null} or empty.
 * @return
 */
public static JpaSort unsafe(Direction direction, String... properties) {
  Assert.notNull(direction, "Direction must not be null!");
  Assert.notEmpty(properties, "Properties must not be empty!");
  Assert.noNullElements(properties, "Properties must not contain null values!");
  return unsafe(direction, Arrays.asList(properties));
}

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
public ConnectFromBuilder startWith(String... fieldReferences) {
  Assert.notNull(fieldReferences, "FieldReferences must not be null!");
  Assert.noNullElements(fieldReferences, "FieldReferences must not contain null elements!");
  List<Object> fields = new ArrayList<Object>(fieldReferences.length);
  for (String fieldReference : fieldReferences) {
    fields.add(Fields.field(fieldReference));
  }
  this.startWith = fields;
  return this;
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Mono<Void> pSubscribe(ByteBuffer... patterns) {
  Assert.notNull(patterns, "Patterns must not be null!");
  Assert.noNullElements(patterns, "Patterns must not contain null elements!");
  return patternState.subscribe(patterns, commands::psubscribe);
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Mono<Void> unsubscribe(ByteBuffer... channels) {
  Assert.notNull(channels, "Channels must not be null!");
  Assert.noNullElements(channels, "Channels must not contain null elements!");
  return ObjectUtils.isEmpty(channels) ? Mono.empty() : channelState.unsubscribe(channels, commands::unsubscribe);
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Mono<Void> subscribe(ByteBuffer... channels) {
  Assert.notNull(channels, "Channels must not be null!");
  Assert.noNullElements(channels, "Channels must not contain null elements!");
  return channelState.subscribe(channels, commands::subscribe);
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Mono<Void> pUnsubscribe(ByteBuffer... patterns) {
  Assert.notNull(patterns, "Patterns must not be null!");
  Assert.noNullElements(patterns, "Patterns must not contain null elements!");
  return ObjectUtils.isEmpty(patterns) ? Mono.empty() : patternState.unsubscribe(patterns, commands::punsubscribe);
}

代码示例来源:origin: spring-projects/spring-data-mongodb

/**
 * Set the plain filter chain to apply.
 *
 * @param pipeline must not be {@literal null} nor contain {@literal null} values.
 * @return this.
 * @see ChangeStreamOptions#getFilter()
 */
public ChangeStreamRequestBuilder<T> filter(Document... pipeline) {
  Assert.notNull(pipeline, "Aggregation pipeline must not be null!");
  Assert.noNullElements(pipeline, "Aggregation pipeline must not contain null elements!");
  this.delegate.filter(pipeline);
  return this;
}

代码示例来源:origin: spring-projects/spring-data-redis

/**
 * Subscribe to one or more {@link ChannelTopic}s and receive a stream of {@link ChannelMessage}. Messages and channel
 * names are treated as {@link String}. The message stream subscribes lazily to the Redis channels and unsubscribes if
 * the {@link org.reactivestreams.Subscription} is {@link org.reactivestreams.Subscription#cancel() cancelled}.
 *
 * @param channelTopics the channels to subscribe.
 * @return the message stream.
 * @throws InvalidDataAccessApiUsageException if {@code patternTopics} is empty.
 * @see #receive(Iterable, SerializationPair, SerializationPair)
 */
public Flux<Message<String, String>> receive(ChannelTopic... channelTopics) {
  Assert.notNull(channelTopics, "ChannelTopics must not be null!");
  Assert.noNullElements(channelTopics, "ChannelTopics must not contain null elements!");
  return receive(Arrays.asList(channelTopics), stringSerializationPair, stringSerializationPair);
}

代码示例来源:origin: spring-projects/spring-data-mongodb

/**
 * Configures {@literal boundaries} and return a new {@link BucketOperation}. Existing {@literal boundaries} are
 * preserved and the new {@literal boundaries} are appended.
 *
 * @param boundaries must not be {@literal null}.
 * @return
 */
public BucketOperation withBoundaries(Object... boundaries) {
  Assert.notNull(boundaries, "Boundaries must not be null!");
  Assert.noNullElements(boundaries, "Boundaries must not contain null values!");
  List<Object> newBoundaries = new ArrayList<Object>(this.boundaries.size() + boundaries.length);
  newBoundaries.addAll(this.boundaries);
  newBoundaries.addAll(Arrays.asList(boundaries));
  return new BucketOperation(this, newBoundaries, defaultBucket);
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Create a {@code FilterChain} with Filter's and a Servlet.
 * @param servlet the {@link Servlet} to invoke in this {@link FilterChain}
 * @param filters the {@link Filter}'s to invoke in this {@link FilterChain}
 * @since 3.2
 */
public MockFilterChain(Servlet servlet, Filter... filters) {
  Assert.notNull(filters, "filters cannot be null");
  Assert.noNullElements(filters, "filters cannot contain null values");
  this.filters = initFilterList(servlet, filters);
}

相关文章