List of usage examples for org.springframework.util StringUtils hasText
public static boolean hasText(@Nullable String str)
From source file:org.springdata.ehcache.config.xml.ConverterParser.java
@Override protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) throws BeanDefinitionStoreException { String id = super.resolveId(element, definition, parserContext); return StringUtils.hasText(id) ? id : ConfigConstants.CONVERTER_DEFAULT_ID; }
From source file:org.web4thejob.security.CustomELRequestMatcherContext.java
public boolean hasHeader(String headerName, String value) { String header = request.getHeader(headerName); if (!StringUtils.hasText(header)) { return false; }//from w w w. j a va2 s. c o m return header.contains(value); }
From source file:com.reactivetechnologies.analytics.lucene.InstanceTokenizer.java
/** * Converts String attributes into a set of attributes representing word occurrence information from the text contained in the strings. * The set of words (attributes) is determined by the first batch filtered (typically training data). Uses a Lucene analyzer to tokenize * the string. NOTE: The text string should either be the first or last attribute * @param dataRaw//from w w w .j a v a 2 s . c o m * @param opts * @param isLast - whether last attribute is the text to be filtered, else first * @return * @throws Exception * @see {@linkplain StringToWordVector} */ public static Instances filter(Instances dataRaw, String opts, boolean isLast) throws Exception { StringToWordVector filter = new StringToWordVector(); if (StringUtils.hasText(opts)) { filter.setOptions(Utils.splitOptions(opts)); } filter.setTokenizer(new InstanceTokenizer()); filter.setUseStoplist(false);//ignore any other stop list filter.setStemmer(new NullStemmer());//ignore any other stemmer filter.setInputFormat(dataRaw); filter.setAttributeIndices(isLast ? "last" : "first"); return Filter.useFilter(dataRaw, filter); }
From source file:org.easit.core.controllers.facebook.FacebookAfterConnectInterceptor.java
@Override public void preConnect(ConnectionFactory<Facebook> connectionFactory, MultiValueMap<String, String> parameters, WebRequest request) {/* w ww. j a va2 s .c o m*/ parameters.set("approval_prompt", "force"); if (StringUtils.hasText(request.getParameter(POST_TO_WALL_PARAMETER))) { request.setAttribute(POST_TO_WALL_ATTRIBUTE, Boolean.TRUE, WebRequest.SCOPE_SESSION); } }
From source file:springfox.documentation.swagger.readers.operation.OperationNotesReader.java
@Override public void apply(OperationContext context) { HandlerMethod handlerMethod = context.getHandlerMethod(); ApiOperation methodAnnotation = handlerMethod.getMethodAnnotation(ApiOperation.class); if (null != methodAnnotation && StringUtils.hasText(methodAnnotation.notes())) { context.operationBuilder().notes(methodAnnotation.notes()); }//from www . java 2 s. c om }
From source file:com.dinstone.jrpc.spring.ReferenceBeanDefinitionParser.java
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { builder.addPropertyValue("service", element.getAttribute("interface")); builder.addPropertyValue("group", element.getAttribute("group")); String timeout = element.getAttribute("timeout"); if (StringUtils.hasText(timeout)) { builder.addPropertyValue("timeout", timeout); }//ww w . j a va 2 s. c o m builder.addPropertyReference("client", getClientBeanId(element.getAttribute("client"))); }
From source file:com.iflytek.edu.cloud.frame.spring.DelegatingFilterProxyExt.java
protected void initFilterBean() throws ServletException { super.initFilterBean(); String appkey = System.getProperty("excludes.appkey"); if (StringUtils.hasText(appkey)) { excludeAppkeys = Arrays.asList(appkey.split(",")); }// w w w . ja va 2 s. co m }
From source file:org.openmrs.module.diabetesmanagement.propertyeditor.InsulinTypeEditor.java
/** * @see java.beans.PropertyEditorSupport#setAsText(java.lang.String) * @param text The string to be parsed./*from www. jav a 2 s. c om*/ */ public void setAsText(String text) { InsulinTypeService its = (InsulinTypeService) Context.getService(InsulinTypeService.class); if (StringUtils.hasText(text)) { try { setValue(its.getInsulinType(Integer.valueOf(text))); } catch (Exception ex) { log.error("Error setting text: " + text, ex); throw new IllegalArgumentException("Department not found: " + ex.getMessage()); } } else { setValue(null); } }
From source file:org.openvpms.component.business.service.security.memory.UserMapEditor.java
@Override public void setAsText(String str) throws IllegalArgumentException { UserMap userMap = new UserMap(); if (StringUtils.hasText(str)) { // Use properties editor to tokenize the string PropertiesEditor propertiesEditor = new PropertiesEditor(); propertiesEditor.setAsText(str); Properties props = (Properties) propertiesEditor.getValue(); addUsersFromProperties(userMap, props); }// w w w . java 2 s . co m setValue(userMap); }
From source file:org.cleverbus.common.Tools.java
/** * Joins the provided input Strings into one String, separated by the provided separator character. * Null and empty elements are skipped.//from w ww . j a va 2s.co m * * @param array an array of String to join together into one String * @param separator separator character to separate the array elements with * @return the string merged from array, separated by the specified character */ public static String joinNonEmpty(String[] array, char separator) { boolean somethingAdded = false; StringBuilder sb = new StringBuilder(); for (String str : array) { if (StringUtils.hasText(str)) { if (!somethingAdded) { somethingAdded = true; } else { sb.append(separator); } sb.append(str); } } return sb.toString(); }