@Override public String toString() { return StringUtils.arrayToDelimitedString(this.expressions, " or "); } }
private String attributeValueToString(Object value) { if (value instanceof Object[]) { return "[" + StringUtils.arrayToDelimitedString((Object[]) value, ", ") + "]"; } return String.valueOf(value); }
/** * Set multiple JAXB context paths. The given array of context paths gets * converted to a colon-delimited string, as supported by JAXB. */ public void setContextPaths(String... contextPaths) { Assert.notEmpty(contextPaths, "'contextPaths' must not be empty"); this.contextPath = StringUtils.arrayToDelimitedString(contextPaths, ":"); }
private String valueToString(Object value) { if (value == this) { return "(this Map)"; } if (value instanceof Object[]) { return "[" + StringUtils.arrayToDelimitedString((Object[]) value, ", ") + "]"; } return String.valueOf(value); }
/** * Convert a {@code String} array into a comma delimited {@code String} * (i.e., CSV). * <p>Useful for {@code toString()} implementations. * @param arr the array to display (potentially {@code null} or empty) * @return the delimited {@code String} */ public static String arrayToCommaDelimitedString(@Nullable Object[] arr) { return arrayToDelimitedString(arr, ","); }
@Override public String toString() { return StringUtils.arrayToDelimitedString(this.expressions, " or "); } }
/** * Build a default String representation for this MessageSourceResolvable: * including codes, arguments, and default message. */ protected final String resolvableToString() { StringBuilder result = new StringBuilder(); result.append("codes [").append(StringUtils.arrayToDelimitedString(this.codes, ",")); result.append("]; arguments [").append(StringUtils.arrayToDelimitedString(this.arguments, ",")); result.append("]; default message [").append(this.defaultMessage).append(']'); return result.toString(); }
private void appendArray(StringBuilder result, String[] arr) { result.append('['); if (arr.length > 0) { result.append('\"'); } result.append(StringUtils.arrayToDelimitedString(arr, "\", \"")); if (arr.length > 0) { result.append('\"'); } result.append(']'); }
@Override public String toString() { PropertyValue[] pvs = getPropertyValues(); StringBuilder sb = new StringBuilder("PropertyValues: length=").append(pvs.length); if (pvs.length > 0) { sb.append("; ").append(StringUtils.arrayToDelimitedString(pvs, "; ")); } return sb.toString(); }
/** * Return an error message string, concatenating all messages * separated by the given delimiter. * @param delimiter separator string, e.g. ", " or "<br>" * @return the error message string */ public String getErrorMessagesAsString(String delimiter) { return StringUtils.arrayToDelimitedString(initErrorMessages(), delimiter); }
/** * Return an error message string, concatenating all messages * separated by the given delimiter. * @param delimiter separator string, e.g. ", " or "<br>" * @return the error message string */ public String getErrorMessagesAsString(String delimiter) { return StringUtils.arrayToDelimitedString(initErrorMessages(), delimiter); }
/** * Build a default String representation for this MessageSourceResolvable: * including codes, arguments, and default message. */ protected final String resolvableToString() { StringBuilder result = new StringBuilder(); result.append("codes [").append(StringUtils.arrayToDelimitedString(this.codes, ",")); result.append("]; arguments [").append(StringUtils.arrayToDelimitedString(this.arguments, ",")); result.append("]; default message [").append(this.defaultMessage).append(']'); return result.toString(); }
private void appendArray(StringBuilder result, String[] arr) { result.append('['); if (arr.length > 0) { result.append('\"'); } result.append(StringUtils.arrayToDelimitedString(arr, "\", \"")); if (arr.length > 0) { result.append('\"'); } result.append(']'); }
@Override public String getMessage() { StringBuilder sb = new StringBuilder("Parameter conditions "); int i = 0; for (String[] conditions : this.paramConditions) { if (i > 0) { sb.append(" OR "); } sb.append("\""); sb.append(StringUtils.arrayToDelimitedString(conditions, ", ")); sb.append("\""); i++; } sb.append(" not met for actual request parameters: "); sb.append(requestParameterMapToString(this.actualParams)); return sb.toString(); }
/** * Handle the case where no request handler method was found for the particular HTTP request method. * <p>The default implementation logs a warning, sends an HTTP 405 error, sets the "Allow" header, * and returns an empty {@code ModelAndView}. Alternatively, a fallback view could be chosen, * or the HttpRequestMethodNotSupportedException could be rethrown as-is. * @param ex the HttpRequestMethodNotSupportedException to be handled * @param request current HTTP request * @param response current HTTP response * @param handler the executed handler, or {@code null} if none chosen * at the time of the exception (for example, if multipart resolution failed) * @return an empty ModelAndView indicating the exception was handled * @throws IOException potentially thrown from {@link HttpServletResponse#sendError} */ protected ModelAndView handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException ex, HttpServletRequest request, HttpServletResponse response, @Nullable Object handler) throws IOException { String[] supportedMethods = ex.getSupportedMethods(); if (supportedMethods != null) { response.setHeader("Allow", StringUtils.arrayToDelimitedString(supportedMethods, ", ")); } response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, ex.getMessage()); return new ModelAndView(); }
@Override public String getAsText() { return StringUtils.arrayToDelimitedString(ObjectUtils.toObjectArray(getValue()), this.separator); }
@RequestMapping("/stringArray") public void processMultipart(@RequestParam("content") String[] content, HttpServletResponse response) throws IOException { response.getWriter().write(StringUtils.arrayToDelimitedString(content, "-")); } }
@RequestMapping("/integerArray") public void processCsv(@RequestParam("content") Integer[] content, HttpServletResponse response) throws IOException { response.getWriter().write(StringUtils.arrayToDelimitedString(content, "-")); } }
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Assert.state(this.target != null, "No HttpRequestHandler available"); LocaleContextHolder.setLocale(request.getLocale()); try { this.target.handleRequest(request, response); } catch (HttpRequestMethodNotSupportedException ex) { String[] supportedMethods = ex.getSupportedMethods(); if (supportedMethods != null) { response.setHeader("Allow", StringUtils.arrayToDelimitedString(supportedMethods, ", ")); } response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, ex.getMessage()); } finally { LocaleContextHolder.resetLocaleContext(); } }
@Override public void setValue(Object value) { if (value instanceof String[]) { setValue(StringUtils.arrayToDelimitedString(((String[]) value), "-")); } else { super.setValue(value != null ? value : ""); } } });