Refine search
/** * Create a new {@code HttpEntity} with the given body, headers, and status code. * @param body the entity body * @param headers the entity headers * @param status the status code */ public ResponseEntity(@Nullable T body, @Nullable MultiValueMap<String, String> headers, HttpStatus status) { super(body, headers); Assert.notNull(status, "HttpStatus must not be null"); this.status = status; }
private boolean shouldHandle(ApplicationEvent event, @Nullable Object[] args) { if (args == null) { return false; } String condition = getCondition(); if (StringUtils.hasText(condition)) { Assert.notNull(this.evaluator, "EventExpressionEvaluator must not be null"); return this.evaluator.condition( condition, event, this.targetMethod, this.methodKey, args, this.applicationContext); } return true; }
@Override public void convertAndSendToUser(String user, String destination, Object payload, @Nullable Map<String, Object> headers, @Nullable MessagePostProcessor postProcessor) throws MessagingException { Assert.notNull(user, "User must not be null"); user = StringUtils.replace(user, "/", "%2F"); destination = destination.startsWith("/") ? destination : "/" + destination; super.convertAndSend(this.destinationPrefix + user + destination, payload, headers, postProcessor); }
@Override public void doWork(Work work, long startTimeout, @Nullable ExecutionContext executionContext, @Nullable WorkListener workListener) throws WorkException { Assert.state(this.syncTaskExecutor != null, "No 'syncTaskExecutor' set"); executeWork(this.syncTaskExecutor, work, startTimeout, false, executionContext, workListener); }
public DefaultResourceTransformerChain(ResourceResolverChain resolverChain, @Nullable ResourceTransformer transformer, @Nullable ResourceTransformerChain chain) { Assert.isTrue((transformer == null && chain == null) || (transformer != null && chain != null), "Both transformer and transformer chain must be null, or neither is"); this.resolverChain = resolverChain; this.transformer = transformer; this.nextChain = chain; }
/** * Decode the given SockJS message frame. * @param content the SockJS message frame * @return an array of messages, or {@code null} if none * @throws IOException if the content could not be parsed */ @Nullable String[] decodeInputStream(InputStream content) throws IOException;
/** * Assert that an array contains elements; that is, it must not be * {@code null} and must contain at least one element. * @deprecated as of 4.3.7, in favor of {@link #notEmpty(Object[], String)} */ @Deprecated public static void notEmpty(@Nullable Object[] array) { notEmpty(array, "[Assertion failed] - this array must not be empty: it must contain at least 1 element"); }
@Nullable @Override public Object resolveArgumentValue( MethodParameter parameter, BindingContext bindingContext, ServerWebExchange exchange) { Assert.isInstanceOf(InitBinderBindingContext.class, bindingContext); return ((InitBinderBindingContext) bindingContext).getSessionStatus(); }
/** * Assert that an array contains no {@code null} elements. * @deprecated as of 4.3.7, in favor of {@link #noNullElements(Object[], String)} */ @Deprecated public static void noNullElements(@Nullable Object[] array) { noNullElements(array, "[Assertion failed] - this array must not contain any null elements"); }
/** * Assert that the given text does not contain the given substring. * @deprecated as of 4.3.7, in favor of {@link #doesNotContain(String, String, String)} */ @Deprecated public static void doesNotContain(@Nullable String textToSearch, String substring) { doesNotContain(textToSearch, substring, () -> "[Assertion failed] - this String argument must not contain the substring [" + substring + "]"); }
@Override public Destination resolveDestinationName(@Nullable Session session, String destinationName, boolean pubSubDomain) throws JMSException { Assert.state(this.beanFactory != null, "BeanFactory is required"); try { return this.beanFactory.getBean(destinationName, Destination.class); } catch (BeansException ex) { throw new DestinationResolutionException( "Failed to look up Destination bean with name '" + destinationName + "'", ex); } }
private DefaultResourceResolverChain(@Nullable ResourceResolver resolver, @Nullable ResourceResolverChain chain) { Assert.isTrue((resolver == null && chain == null) || (resolver != null && chain != null), "Both resolver and resolver chain must be null, or neither is"); this.resolver = resolver; this.nextChain = chain; }
/** * Protected accessor for internal use. */ @Nullable protected Integer getSendTimeLimit() { return this.sendTimeLimit; }
/** * Assert that a collection contains elements; that is, it must not be * {@code null} and must contain at least one element. * @deprecated as of 4.3.7, in favor of {@link #notEmpty(Collection, String)} */ @Deprecated public static void notEmpty(@Nullable Collection<?> collection) { notEmpty(collection, "[Assertion failed] - this collection must not be empty: it must contain at least 1 element"); }
/** * Constructor for a part with a filename and byte[] content. * @see #getHeaders() */ public MockPart(String name, @Nullable String filename, @Nullable byte[] content) { Assert.hasLength(name, "'name' must not be empty"); this.name = name; this.filename = filename; this.content = (content != null ? content : new byte[0]); this.headers.setContentDispositionFormData(name, filename); }
/** * Create a new {@code HttpEntity} with the given body, headers, and status code. * Just used behind the nested builder API. * @param body the entity body * @param headers the entity headers * @param status the status code (as {@code HttpStatus} or as {@code Integer} value) */ private ResponseEntity(@Nullable T body, @Nullable MultiValueMap<String, String> headers, Object status) { super(body, headers); Assert.notNull(status, "HttpStatus must not be null"); this.status = status; }
/** * Create a trigger with the given period and time unit. The time unit will * apply not only to the period but also to any 'initialDelay' value, if * configured on this Trigger later via {@link #setInitialDelay(long)}. */ public PeriodicTrigger(long period, @Nullable TimeUnit timeUnit) { Assert.isTrue(period >= 0, "period must not be negative"); this.timeUnit = (timeUnit != null ? timeUnit : TimeUnit.MILLISECONDS); this.period = this.timeUnit.toMillis(period); }