/** * Set the namespace URI of the service. * Corresponds to the WSDL "targetNamespace". */ public void setNamespaceUri(@Nullable String namespaceUri) { this.namespaceUri = (namespaceUri != null ? namespaceUri.trim() : null); }
public static boolean empty( final String s ) { // Null-safe, short-circuit evaluation. return s == null || s.trim().isEmpty(); }
/** * Add a field with the specified value without any validation. Only appropriate for headers * from the remote peer or cache. */ Builder addLenient(String name, String value) { namesAndValues.add(name); namesAndValues.add(value.trim()); return this; }
public Builder value(String value) { if (value == null) throw new NullPointerException("value == null"); if (!value.trim().equals(value)) throw new IllegalArgumentException("value is not trimmed"); this.value = value; return this; }
public Builder name(String name) { if (name == null) throw new NullPointerException("name == null"); if (!name.trim().equals(name)) throw new IllegalArgumentException("name is not trimmed"); this.name = name; return this; }
private static String getSubmittedFileName(Part part) { for (String cd : part.getHeader("content-disposition").split(";")) { if (cd.trim().startsWith("filename")) { String fileName = cd.substring(cd.indexOf('=') + 1).trim().replace("\"", ""); return fileName.substring(fileName.lastIndexOf('/') + 1).substring(fileName.lastIndexOf('\\') + 1); // MSIE fix. } } return null; }
String toChainString() { StringBuilder buf = new StringBuilder(); PathElement pe = this.head; while (pe != null) { buf.append(pe.toString()).append(" "); pe = pe.next; } return buf.toString().trim(); }
private static boolean initCacheSectionFlag(String line, @Nullable LineInfo previousLine) { if (MANIFEST_SECTION_HEADERS.contains(line.trim())) { return line.trim().equals(CACHE_HEADER); } else if (previousLine != null) { return previousLine.isCacheSection(); } throw new IllegalStateException( "Manifest does not start with " + MANIFEST_HEADER + ": " + line); }
Props(Element root) { String defaultCache = root.getAttribute("cache"); this.key = root.getAttribute("key"); this.keyGenerator = root.getAttribute("key-generator"); this.cacheManager = root.getAttribute("cache-manager"); this.condition = root.getAttribute("condition"); this.method = root.getAttribute(METHOD_ATTRIBUTE); if (StringUtils.hasText(defaultCache)) { this.caches = StringUtils.commaDelimitedListToStringArray(defaultCache.trim()); } }
/** Add an header line containing a field name, a literal colon, and a value. */ public Builder add(String line) { int index = line.indexOf(":"); if (index == -1) { throw new IllegalArgumentException("Unexpected header: " + line); } return add(line.substring(0, index).trim(), line.substring(index + 1)); }
static BeanDefinition parseKeyGenerator(Element element, BeanDefinition def) { String name = element.getAttribute("key-generator"); if (StringUtils.hasText(name)) { def.getPropertyValues().add("keyGenerator", new RuntimeBeanReference(name.trim())); } return def; }
@Override @Nullable public String resolveStringValue(String strVal) throws BeansException { String resolved = this.helper.replacePlaceholders(strVal, this.resolver); if (trimValues) { resolved = resolved.trim(); } return (resolved.equals(nullValue) ? null : resolved); } }
private static void parseErrorHandler(Element element, BeanDefinition def) { String name = element.getAttribute("error-handler"); if (StringUtils.hasText(name)) { def.getPropertyValues().add("errorHandler", new RuntimeBeanReference(name.trim())); } }
public static Method findMethod(String desc, ClassLoader loader) { try { int lparen = desc.indexOf('('); int dot = desc.lastIndexOf('.', lparen); String className = desc.substring(0, dot).trim(); String methodName = desc.substring(dot + 1, lparen).trim(); return getClass(className, loader).getDeclaredMethod(methodName, parseTypes(desc, loader)); } catch (ClassNotFoundException | NoSuchMethodException ex) { throw new CodeGenerationException(ex); } }
@Override public String apply(String t1) { return t1.trim().toLowerCase(); } };
@Override public String apply(String t1) { return t1.trim().toLowerCase(); } };
public static Constructor findConstructor(String desc, ClassLoader loader) { try { int lparen = desc.indexOf('('); String className = desc.substring(0, lparen).trim(); return getClass(className, loader).getConstructor(parseTypes(desc, loader)); } catch (ClassNotFoundException | NoSuchMethodException ex) { throw new CodeGenerationException(ex); } }
private List<String> splitCookie(String value) { List<String> list = new ArrayList<>(); for (String s : value.split(";")){ list.add(s.trim()); } return list; }
/** * Parse the {@code class} XML elements. */ protected void parseManagedClasses(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) { List<Element> classes = DomUtils.getChildElementsByTagName(persistenceUnit, MANAGED_CLASS_NAME); for (Element element : classes) { String value = DomUtils.getTextValue(element).trim(); if (StringUtils.hasText(value)) { unitInfo.addManagedClassName(value); } } }
@Test public void noTrim() throws Exception { StringArrayPropertyEditor editor = new StringArrayPropertyEditor(",",false,false); editor.setAsText(" 0,1 , 2 "); Object value = editor.getValue(); String[] array = (String[]) value; for (int i = 0; i < array.length; ++i) { assertEquals(3, array[i].length()); assertEquals("" + i, array[i].trim()); } assertEquals(" 0,1 , 2 ", editor.getAsText()); }