Java Code Examples for org.springframework.util.Assert#noNullElements()

The following examples show how to use org.springframework.util.Assert#noNullElements() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Set the config locations for this application context.
 * <p>If not set, the implementation may use a default as appropriate.
 */
public void setConfigLocations(@Nullable String... locations) {
	if (locations != null) {
		Assert.noNullElements(locations, "Config locations must not be null");
		// 注释 1.2 将配置资源路径放入 configLocations 数组中
		this.configLocations = new String[locations.length];
		for (int i = 0; i < locations.length; i++) {
			this.configLocations[i] = resolvePath(locations[i]).trim();
		}
	}
	else {
		this.configLocations = null;
	}
}
 
Example 2
Source Project: dubbox   File: SolrRealtimeGetRequest.java    License: Apache License 2.0 5 votes vote down vote up
public SolrRealtimeGetRequest(Collection<? extends Serializable> ids) {
	super(METHOD.GET, "/get");

	Assert.notEmpty(ids, "At least one 'id' is required for real time get request.");
	Assert.noNullElements(ids.toArray(), "Real time get request can't be made for 'null' id.");

	toStringIds(ids);
}
 
Example 3
Source Project: spring-analysis-note   File: MockMvc.java    License: MIT License 5 votes vote down vote up
/**
 * 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();
}
 
Example 4
@Override
public void delete(String path, Version... versionsToDelete) {

	Assert.hasText(path, "Path must not be empty");
	Assert.noNullElements(versionsToDelete, "Versions must not be null");

	if (versionsToDelete.length == 0) {
		delete(path);
		return;
	}

	List<Integer> versions = toVersionList(versionsToDelete);

	doWrite(createBackendPath("delete", path), Collections.singletonMap("versions", versions));
}
 
Example 5
Source Project: dubbox   File: FacetOptions.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates new instance faceting on given fields
 * 
 * @param fieldnames
 */
public FacetOptions(Field... fields) {
	Assert.notNull(fields, "Fields must not be null.");
	Assert.noNullElements(fields, "Cannot facet on null field.");

	for (Field field : fields) {
		addFacetOnField(field);
	}
}
 
Example 6
Source Project: spring-boot   File: SearchFilter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 构造一个 between and 查询条件
 * CriteriaBuilder between  包含两个边界 : betweenFrom <= object <= betweenTo
 *
 * @param fieldName
 * @param operator
 * @param betweenFrom
 * @param betweenTo
 */
public SearchFilter(String fieldName, Operator operator, Object betweenFrom, Object betweenTo) {

    Assert.isTrue(operator.equals(Operator.BETWEEN), "between 操作,operator 必须为 Operator.BETWEEN");
    Assert.hasText(fieldName, "fieldName 没有填写");
    Assert.noNullElements(new Object[]{betweenFrom, betweenTo}, "between 操作,betweenFrom , betweenTo 均不能为 null");

    this.fieldName = fieldName;
    this.betweenFrom = betweenFrom;
    this.betweenTo = betweenTo;
    this.operator = operator;

}
 
Example 7
/**
 * Set the patterns of the headers to be mapped in {@link #toHeaders(Map)}.
 * First patterns take precedence.
 * @param inboundHeaderPatterns header patterns to be mapped
 */
public void setInboundHeaderPatterns(String... inboundHeaderPatterns) {
	Assert.notNull(inboundHeaderPatterns, "Header patterns can't be null.");
	Assert.noNullElements(inboundHeaderPatterns, "No header pattern can be null.");
	this.inboundHeaderPatterns =
			Arrays.copyOf(inboundHeaderPatterns, inboundHeaderPatterns.length);
}
 
Example 8
/**
 * Set the config locations for this application context.
 * <p>If not set, the implementation may use a default as appropriate.
 */
public void setConfigLocations(String... locations) {
	if (locations != null) {
		Assert.noNullElements(locations, "Config locations must not be null");
		this.configLocations = new String[locations.length];
		for (int i = 0; i < locations.length; i++) {
			this.configLocations[i] = resolvePath(locations[i]).trim();
		}
	}
	else {
		this.configLocations = null;
	}
}
 
Example 9
/**
 * Set the config locations for this application context.
 * <p>If not set, the implementation may use a default as appropriate.
 */
public void setConfigLocations(String... locations) {
	if (locations != null) {
		Assert.noNullElements(locations, "Config locations must not be null");
		this.configLocations = new String[locations.length];
		for (int i = 0; i < locations.length; i++) {
			this.configLocations[i] = resolvePath(locations[i]).trim();
		}
	}
	else {
		this.configLocations = null;
	}
}
 
Example 10
public static Isbn parseFrom(String isbn) {
    Assert.notNull(isbn);
    String[] parts = isbn.split("-");
    Assert.state(parts.length == 5);
    Assert.noNullElements(parts);
    return new Isbn(parts[0], parts[1], parts[2], parts[3], parts[4]);
}
 
Example 11
Source Project: spring-vault   File: Policy.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a {@link Policy} from one or more {@code rules}.
 * @param rules must not be {@literal null}.
 * @return the {@link Policy} object containing {@code rules}.
 */
public static Policy of(Rule... rules) {

	Assert.notNull(rules, "Rules must not be null");
	Assert.noNullElements(rules, "Rules must not contain null elements");

	return new Policy(new LinkedHashSet<>(Arrays.asList(rules)));
}
 
Example 12
public static Isbn parseFrom(String isbn) {
    Assert.notNull(isbn);
    String[] parts = isbn.split("-");
    Assert.state(parts.length == 5);
    Assert.noNullElements(parts);
    return new Isbn(parts[0], parts[1], parts[2], parts[3], parts[4]);
}
 
Example 13
Source Project: Moss   File: ProbeEndpointsStrategy.java    License: Apache License 2.0 4 votes vote down vote up
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;
}
 
Example 14
private void assertContentsOfScriptArray(Resource... scripts) {
	Assert.notNull(scripts, "Scripts array must not be null");
	Assert.noNullElements(scripts, "Scripts array must not contain null elements");
}
 
Example 15
Source Project: spring-analysis-note   File: MockFilterChain.java    License: MIT License 2 votes vote down vote up
/**
 * 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);
}
 
Example 16
Source Project: spring-analysis-note   File: MockFilterChain.java    License: MIT License 2 votes vote down vote up
/**
 * 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);
}
 
Example 17
/**
 * 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);
}
 
Example 18
Source Project: java-technology-stack   File: MockFilterChain.java    License: MIT License 2 votes vote down vote up
/**
 * 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);
}
 
Example 19
Source Project: java-technology-stack   File: MockFilterChain.java    License: MIT License 2 votes vote down vote up
/**
 * 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);
}
 
Example 20
/**
 * 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);
}