List of usage examples for org.apache.commons.lang StringUtils trimToNull
public static String trimToNull(String str)
Removes control characters (char <= 32) from both ends of this String returning null
if the String is empty ("") after the trim or if it is null
.
From source file:com.alibaba.dubbo.governance.web.governance.module.screen.Loadbalances.java
public void index(Map<String, Object> context) { final String service = StringUtils.trimToNull((String) context.get("service")); List<LoadBalance> loadbalances; if (service != null && service.length() > 0) { loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findByService(service)); loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findByService(service)); } else {/*from w w w . ja v a2s . co m*/ loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findAll()); } context.put("loadbalances", loadbalances); }
From source file:com.bluexml.side.util.dependencies.WorkbenchPreferencePage1.java
public static String getLocationPreference() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String locationPreference = store.getString(MAVEN_REPO_LOCATION); if (StringUtils.trimToNull(locationPreference) == null) { locationPreference = RepositorySystem.defaultUserLocalRepository.toString(); }/*from w w w . ja v a 2s. co m*/ return locationPreference; }
From source file:com.opengamma.install.launch.MainRunner.java
protected String[] getParameters(String args) { s_logger.debug("processing args [{}]", args); args = StringUtils.trimToNull(args); final String[] tokens = StringUtils.split(args); String[] result = null;//from w w w. java 2 s . c om if (tokens != null) { List<String> argList = Lists.newArrayList(); StringBuilder strBuilder = new StringBuilder(); for (String token : tokens) { boolean processed = false; if (token.startsWith("'")) { strBuilder.append(token); processed = true; } if (token.endsWith("'")) { if (strBuilder.length() != 0) { if (!processed) { strBuilder.append(" ").append(token); } argList.add(strBuilder.substring(1, strBuilder.length() - 1)); } else { argList.add(token); } strBuilder = new StringBuilder(); processed = true; } if (!processed) { if (strBuilder.length() == 0) { argList.add(token); } else { strBuilder.append(" ").append(token); } } } if (strBuilder.length() != 0) { argList.addAll(Arrays.asList(StringUtils.split(strBuilder.toString()))); } result = argList.toArray(new String[] {}); } s_logger.debug("processed args {}", ArrayUtils.toString(result)); return result; }
From source file:com.bluexml.xforms.generator.forms.renderable.forms.field.RenderableRegexInput.java
public RenderableRegexInput(XFormsGenerator generationManager, FormElement parent, CF formElement, String regexp) {//from w w w . ja v a 2s . c o m super(generationManager, parent, formElement, "string"); this.regexp = StringUtils.trimToNull(regexp); }
From source file:com.thistech.spotlink.model.MediaFile.java
public MediaFile(VAST.Ad.InLine.Creatives.Creative.Linear.MediaFiles.MediaFile vastMediaFile) { if (vastMediaFile != null) { if (vastMediaFile.getHeight() != null) { this.height = vastMediaFile.getHeight().intValue(); }//from ww w . j a v a 2 s .c o m if (vastMediaFile.getWidth() != null) { this.width = vastMediaFile.getWidth().intValue(); } this.type = vastMediaFile.getType(); this.url = StringUtils.trimToNull(vastMediaFile.getValue()); } }
From source file:fm.last.citrine.notification.BaseNotifier.java
protected String getDisplayLogUrl(TaskRun taskRun) { if (StringUtils.trimToNull(baseCitrineUrl) == null) { return null; }//from ww w. j av a 2s . c o m return baseCitrineUrl + VIEW_LOG_PATH.replace("$", String.valueOf(taskRun.getId())); }
From source file:com.egt.core.util.JS.java
public static String getCloseWindowJavaScript(String field, String value, String button) { VelocityContext context = new VelocityContext(); context.put("field", StringUtils.trimToNull(field)); context.put("value", StringUtils.trimToNull(value)); context.put("button", StringUtils.trimToNull(button)); return merge("js-close-window", context); }
From source file:au.org.ala.names.model.NameSearchResult.java
public NameSearchResult(String id, String lsid, MatchType type) { this.id = id;//Long.parseLong(id); this.lsid = StringUtils.trimToNull(lsid) == null ? id : StringUtils.trimToNull(lsid); matchType = type;/*from ww w .j av a 2s . c o m*/ isHomonym = false; }
From source file:com.haulmont.cuba.gui.components.filter.UserSetHelper.java
public static Set<String> parseSet(String text) { Set<String> set = new HashSet<>(); if ("NULL".equals(StringUtils.trimToEmpty(text))) return set; String[] ids = text.split(","); for (String id : ids) { String s = StringUtils.trimToNull(id); if (s != null) set.add(s);// w w w . j av a 2 s . c om } return set; }
From source file:ips1ap101.lib.core.app.OrdenConjuntoResultados.java
@Override public String toString() { String order = StringUtils.EMPTY; String token;/* w w w . ja v a 2 s .c om*/ for (CriterioOrden criterio : criterios) { token = criterio.toString(); order += StringUtils.isBlank(token) ? "" : COMA + token; } order = StringUtils.removeStart(order, COMA); return StringUtils.trimToNull(order); }