List of usage examples for org.apache.commons.lang3 StringUtils split
public static String[] split(final String str, final String separatorChars)
Splits the provided text into an array, separators specified.
From source file:com.pytsoft.cachelock.util.KeyUtils.java
/** * Parse lock expiration time from lock value stored in lock key. * * <p>If parameter is null or with invalid format, then return 0. * * @param lockValue/*ww w .j ava2 s.c o m*/ * Lock value stored in lock key * * @return Lock expiration time in milliseconds */ public static long parseTime(String lockValue) { if (lockValue != null) { try { String timeStr = StringUtils.split(lockValue, Constants.NAMESPACE_SEPARATOR)[1]; return Long.parseLong(timeStr); } catch (Exception e) { LOG.warn(String.format("Input lock value[%s] parsed failed, reason:[%s], will return 0.", lockValue, e.getMessage())); return 0; } } return 0; }
From source file:br.com.asisprojetos.DAO.TBRelatorioDiagnosticoDAO.java
/** * Busca cliente e suas filiais/*from w ww .j a va2 s .co m*/ * @param codCliente * @return **/ public String getHierarchyClients(String codCliente) { List<String> listCodCliente = Arrays.asList(StringUtils.split(codCliente, ',')); String SQL = "SELECT" + " GROUP_CONCAT(COD_CLIENTE) " + " FROM " + " SPF_TBCLIENTE " + " WHERE " + " COD_MATRIZ IN ( :codCliente ) " + " AND COD_MATRIZ <> COD_CLIENTE "; MapSqlParameterSource namedParameters = new MapSqlParameterSource(); namedParameters.addValue("codCliente", listCodCliente); String groupCliente = null; try { groupCliente = getNamedParameterJdbcTemplate().queryForObject(SQL, namedParameters, String.class); } catch (DataAccessException ex) { logger.error("Erro ao efetuar busca no banco de dados. Message {}", ex); } if (groupCliente == null) { return codCliente; } else { return codCliente + "," + getHierarchyClients(groupCliente); } }
From source file:com.funtl.framework.smoke.core.modules.sys.utils.DictUtils.java
public static String getDictLabels(String values, String type, String defaultValue) { if (StringUtils.isNotBlank(type) && StringUtils.isNotBlank(values)) { List<String> valueList = Lists.newArrayList(); for (String value : StringUtils.split(values, ",")) { valueList.add(getDictLabel(value, type, defaultValue)); }//ww w . j a v a2s.c o m return StringUtils.join(valueList, ","); } return defaultValue; }
From source file:cn.com.infcn.ade.common.utils.Reflections.java
/** * Setter, ???// w w w .ja v a2s . c om * ???.??. */ public static void invokeSetter(Object obj, String propertyName, Object value) { Object object = obj; String[] names = StringUtils.split(propertyName, "."); for (int i = 0; i < names.length; i++) { if (i < names.length - 1) { String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]); object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); } else { String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]); invokeMethodByName(object, setterMethodName, new Object[] { value }); } } }
From source file:com.cognifide.qa.bb.utils.PropertyUtils.java
/** * This util method gather system and class path properties, and returns them as <code>Properties</code> * object./* w ww. j av a 2 s .c om*/ * * @return Properties - object with all properties. */ public static Properties gatherProperties() { if (properties == null) { try { String parents = System.getProperty(ConfigKeys.CONFIGURATION_PATHS, "src/main/config"); String[] split = StringUtils.split(parents, ";"); properties = loadDefaultProperties(); for (String name : split) { File configParent = new File(StringUtils.trim(name)); loadProperties(configParent, properties); } overrideFromSystemProperties(properties); setSystemProperties(properties); overrideTimeouts(properties); } catch (IOException e) { LOG.error("Can't bind properties", e); } } return properties; }
From source file:com.quancheng.saluki.core.grpc.router.GrpcRouterFactory.java
public GrpcRouter createRouter(String routerMessage) { if (!routerMessage.startsWith("condition://")) { String[] router = StringUtils.split(routerMessage, "://"); if (router.length == 2) { String type = router[0]; String routerScript = router[1]; return new ScriptRouter(type, routerScript); }//w ww . j a v a 2 s .c om throw new IllegalStateException(new IllegalStateException("No router type for script")); } else { routerMessage = routerMessage.replaceAll("condition://", ""); return new ConditionRouter(routerMessage); } }
From source file:actions.support.PathParser.java
public PathParser(String path) { this.pathSegments = StringUtils.split(path, DELIM); }
From source file:io.wcm.wcm.parsys.controller.CssBuilder.java
/** * Add CSS class item. Empty/Null items are ignore.d * @param cssClass Item//from w w w . jav a 2s. c o m */ public void add(String cssClass) { if (StringUtils.isBlank(cssClass)) { return; } String[] parts = StringUtils.split(cssClass, " "); for (String part : parts) { items.add(StringUtils.trim(part)); } }
From source file:com.garethahealy.loadbalancer.healthchecks.fabric8.gateway.http.ContextCount.java
public void init() { contexts = new HashMap<String, Integer>(); String[] items = StringUtils.split(contextCounts, ','); for (String item : items) { String[] contextCount = StringUtils.split(item, "|"); String context = contextCount[0].substring(1, contextCount[0].length()); Integer count = Integer.parseInt(contextCount[1].substring(0, contextCount[1].length() - 1)); contexts.put(context, count);//from w ww .j a v a 2 s . co m } }
From source file:com.shz.foundation.service.dynamic.SearchFilter.java
/** * searchParamskey?OPERATOR_FIELDNAME//from w ww. j av a2 s. c o m */ public static Map<String, SearchFilter> parse(Map<String, Object> searchParams) { Map<String, SearchFilter> filters = Maps.newHashMap(); for (Entry<String, Object> entry : searchParams.entrySet()) { // String key = entry.getKey(); Object value = entry.getValue(); if (StringUtils.isBlank((String) value)) { continue; } // operatorfiledAttribute String[] names = StringUtils.split(key, "_"); if (names.length != 2) { throw new IllegalArgumentException(key + " is not a valid search filter name"); } String filedName = names[1]; Operator operator = Operator.fromString(names[0]); // searchFilter SearchFilter filter = new SearchFilter(filedName, operator, value); filters.put(key, filter); } return filters; }