Refine search
/** * Create a new {@code BufferingStompDecoder} wrapping the given {@code StompDecoder}. * @param stompDecoder the target decoder to wrap * @param bufferSizeLimit the buffer size limit */ public BufferingStompDecoder(StompDecoder stompDecoder, int bufferSizeLimit) { Assert.notNull(stompDecoder, "StompDecoder is required"); Assert.isTrue(bufferSizeLimit > 0, "Buffer size limit must be greater than 0"); this.stompDecoder = stompDecoder; this.bufferSizeLimit = bufferSizeLimit; }
/** * Create a new {@code ResourceRegion} from a given {@link Resource}. * This region of a resource is represented by a start {@code position} * and a byte {@code count} within the given {@code Resource}. * @param resource a Resource * @param position the start position of the region in that resource * @param count the byte count of the region in that resource */ public ResourceRegion(Resource resource, long position, long count) { Assert.notNull(resource, "Resource must not be null"); Assert.isTrue(position >= 0, "'position' must be larger than or equal to 0"); Assert.isTrue(count >= 0, "'count' must be larger than or equal to 0"); this.resource = resource; this.position = position; this.count = count; }
/** * Construct a new {@code SpringFailOnTimeout} statement for the supplied * {@code timeout}. * <p>If the supplied {@code timeout} is {@code 0}, the execution of the * {@code next} statement will not be timed. * @param next the next {@code Statement} in the execution chain; never {@code null} * @param timeout the configured {@code timeout} for the current test, in milliseconds; * never negative */ public SpringFailOnTimeout(Statement next, long timeout) { Assert.notNull(next, "next statement must not be null"); Assert.isTrue(timeout >= 0, "timeout must be non-negative"); this.next = next; this.timeout = timeout; }
/** * Set the interface that the proxy must implement. * @param serviceInterface the interface that the proxy must implement * @throws IllegalArgumentException if the supplied {@code serviceInterface} * is not an interface type */ public void setServiceInterface(Class<?> serviceInterface) { Assert.notNull(serviceInterface, "'serviceInterface' must not be null"); Assert.isTrue(serviceInterface.isInterface(), "'serviceInterface' must be an interface"); this.serviceInterface = serviceInterface; }
/** * Set the interface of the service to export. * The interface must be suitable for the particular service and remoting strategy. */ public void setServiceInterface(Class<?> serviceInterface) { Assert.notNull(serviceInterface, "'serviceInterface' must not be null"); Assert.isTrue(serviceInterface.isInterface(), "'serviceInterface' must be an interface"); this.serviceInterface = serviceInterface; }
/** * Sets the cache directory. If this property is set to an existing directory, * this converter will cache image data. */ public void setCacheDir(File cacheDir) { Assert.notNull(cacheDir, "'cacheDir' must not be null"); Assert.isTrue(cacheDir.isDirectory(), "'cacheDir' is not a directory"); this.cacheDir = cacheDir; }
public ReflectiveElementFactory(Class<? extends E> elementClass) { Assert.notNull(elementClass, "Element class must not be null"); Assert.isTrue(!elementClass.isInterface(), "Element class must not be an interface type"); Assert.isTrue(!Modifier.isAbstract(elementClass.getModifiers()), "Element class cannot be an abstract class"); this.elementClass = elementClass; }
/** * Set the interface of the service to access. * The interface must be suitable for the particular service and remoting strategy. * <p>Typically required to be able to create a suitable service proxy, * but can also be optional if the lookup returns a typed proxy. */ public void setServiceInterface(Class<?> serviceInterface) { Assert.notNull(serviceInterface, "'serviceInterface' must not be null"); Assert.isTrue(serviceInterface.isInterface(), "'serviceInterface' must be an interface"); this.serviceInterface = serviceInterface; }
/** * Set the interface of the service to access. * The interface must be suitable for the particular service and remoting tool. * <p>Typically required to be able to create a suitable service proxy, * but can also be optional if the lookup returns a typed stub. */ public void setServiceInterface(Class<?> serviceInterface) { Assert.notNull(serviceInterface, "'serviceInterface' must not be null"); Assert.isTrue(serviceInterface.isInterface(), "'serviceInterface' must be an interface"); this.serviceInterface = serviceInterface; }
public final void addSession(Session session, @Nullable Connection connection) { Assert.isTrue(!this.frozen, "Cannot add Session because JmsResourceHolder is frozen"); Assert.notNull(session, "Session must not be null"); if (!this.sessions.contains(session)) { this.sessions.add(session); if (connection != null) { List<Session> sessions = this.sessionsPerConnection.computeIfAbsent(connection, k -> new LinkedList<>()); sessions.add(session); } } }
/** * Add an argument value for the given index in the constructor argument list. * @param index the index in the constructor argument list * @param newValue the argument value in the form of a ValueHolder */ public void addIndexedArgumentValue(int index, ValueHolder newValue) { Assert.isTrue(index >= 0, "Index must not be negative"); Assert.notNull(newValue, "ValueHolder must not be null"); addOrMergeIndexedArgumentValue(index, newValue); }
/** * Set the default HTTP Status to use for redirects. * <p>By default this is {@link HttpStatus#SEE_OTHER}. * @param status the 3xx redirect status to use */ public void setRedirectStatus(HttpStatus status) { Assert.notNull(status, "Property 'redirectStatus' is required"); Assert.isTrue(status.is3xxRedirection(), "Not a redirect status code"); this.redirectStatus = status; }
/** * Set the interface of the service to export. * The interface must be suitable for the particular service and remoting strategy. */ public void setServiceInterface(Class<?> serviceInterface) { Assert.notNull(serviceInterface, "'serviceInterface' must not be null"); Assert.isTrue(serviceInterface.isInterface(), "'serviceInterface' must be an interface"); this.serviceInterface = serviceInterface; }
/** * Set the interface of the service to access. * The interface must be suitable for the particular service and remoting tool. * <p>Typically required to be able to create a suitable service proxy, * but can also be optional if the lookup returns a typed stub. */ public void setServiceInterface(Class<?> serviceInterface) { Assert.notNull(serviceInterface, "'serviceInterface' must not be null"); Assert.isTrue(serviceInterface.isInterface(), "'serviceInterface' must be an interface"); this.serviceInterface = serviceInterface; }
/** * Set the interface of the service to access. * The interface must be suitable for the particular service and remoting strategy. * <p>Typically required to be able to create a suitable service proxy, * but can also be optional if the lookup returns a typed proxy. */ public void setServiceInterface(Class<?> serviceInterface) { Assert.notNull(serviceInterface, "'serviceInterface' must not be null"); Assert.isTrue(serviceInterface.isInterface(), "'serviceInterface' must be an interface"); this.serviceInterface = serviceInterface; }
public ReflectiveElementFactory(Class<? extends E> elementClass) { Assert.notNull(elementClass, "Element class must not be null"); Assert.isTrue(!elementClass.isInterface(), "Element class must not be an interface type"); Assert.isTrue(!Modifier.isAbstract(elementClass.getModifiers()), "Element class cannot be an abstract class"); this.elementClass = elementClass; }
/** * Attempt to find a {@link Field field} on the supplied {@link Class} with the * supplied {@code name} and/or {@link Class type}. Searches all superclasses * up to {@link Object}. * @param clazz the class to introspect * @param name the name of the field (may be {@code null} if type is specified) * @param type the type of the field (may be {@code null} if name is specified) * @return the corresponding Field object, or {@code null} if not found */ @Nullable public static Field findField(Class<?> clazz, @Nullable String name, @Nullable Class<?> type) { Assert.notNull(clazz, "Class must not be null"); Assert.isTrue(name != null || type != null, "Either name or type of the field must be specified"); Class<?> searchType = clazz; while (Object.class != searchType && searchType != null) { Field[] fields = getDeclaredFields(searchType); for (Field field : fields) { if ((name == null || name.equals(field.getName())) && (type == null || type.equals(field.getType()))) { return field; } } searchType = searchType.getSuperclass(); } return null; }
/** * Constructor accepting a request and response pair that are expected to be of type * {@link ServletServerHttpRequest} and {@link ServletServerHttpResponse} * respectively. */ public ServletServerHttpAsyncRequestControl(ServletServerHttpRequest request, ServletServerHttpResponse response) { Assert.notNull(request, "request is required"); Assert.notNull(response, "response is required"); Assert.isTrue(request.getServletRequest().isAsyncSupported(), "Async support must be enabled on a servlet and for all filters involved " + "in async request processing. This is done in Java code using the Servlet API " + "or by adding \"<async-supported>true</async-supported>\" to servlet and " + "filter declarations in web.xml. Also you must use a Servlet 3.0+ container"); this.request = request; this.response = response; }
/** * Add an argument value for the given index in the constructor argument list. * @param index the index in the constructor argument list * @param newValue the argument value in the form of a ValueHolder */ public void addIndexedArgumentValue(int index, ValueHolder newValue) { Assert.isTrue(index >= 0, "Index must not be negative"); Assert.notNull(newValue, "ValueHolder must not be null"); addOrMergeIndexedArgumentValue(index, newValue); }