List of usage examples for org.apache.commons.lang StringUtils trimToEmpty
public static String trimToEmpty(String str)
Removes control characters (char <= 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is null
.
From source file:hudson.plugins.sonar.SonarPublisher.java
/** * @return additional Maven options like "-Pprofile" and "-Dname=value" */// w w w .ja va 2s . c o m public String getJobAdditionalProperties() { return StringUtils.trimToEmpty(jobAdditionalProperties); }
From source file:com.prowidesoftware.swift.model.field.Field255.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//* w ww . ja va 2 s . c o m*/ @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(StringUtils.trimToEmpty(getComponent1())); result.append(StringUtils.trimToEmpty(getComponent2())); result.append(StringUtils.trimToEmpty(getComponent3())); result.append(StringUtils.trimToEmpty(getComponent4())); if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent5())) { result.append(StringUtils.trimToEmpty(getComponent5())); } if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent6())) { result.append(StringUtils.trimToEmpty(getComponent6())); } return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field61.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//*w w w.ja v a2 s. c o m*/ @Override public String getValue() { final StringBuilder result = new StringBuilder(); // CUSTOM pattern for field 61 result.append(StringUtils.trimToEmpty(getComponent1())); result.append(StringUtils.trimToEmpty(getComponent2())); result.append(StringUtils.trimToEmpty(getComponent3())); result.append(StringUtils.trimToEmpty(getComponent4())); result.append(StringUtils.trimToEmpty(getComponent5())); result.append(StringUtils.trimToEmpty(getComponent6())); result.append(StringUtils.trimToEmpty(getComponent7())); result.append(StringUtils.trimToEmpty(getComponent8())); if (StringUtils.isNotEmpty(getComponent9())) { result.append("//"); result.append(StringUtils.trimToEmpty(getComponent9())); } if (StringUtils.isNotEmpty(getComponent10())) { result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL); result.append(StringUtils.trimToEmpty(getComponent10())); } return result.toString(); }
From source file:com.iyonger.apm.web.controller.FileEntryController.java
/** * Add a folder on the given path./*from www. j a v a 2s. c om*/ * * @param user current user * @param path path in which folder will be added * @param folderName folderName * @param model model. * @return redirect:/script/list/${path} */ @RequestMapping(value = "/new/**", params = "type=folder", method = RequestMethod.POST) public String addFolder(User user, @RemainedPath String path, @RequestParam("folderName") String folderName, ModelMap model) { // "fileName" fileEntryService.addFolder(user, path, StringUtils.trimToEmpty(folderName), ""); model.clear(); return "redirect:/script/list/" + path; }
From source file:adalid.core.DisplayField.java
@Override public int compareTo(DisplayField o) { DisplayField that;//w w w .j a v a2 s . co m if (o != null) { that = o; String thisName = StringUtils.trimToEmpty(this.getName()); String thatName = StringUtils.trimToEmpty(that.getName()); return thisName.compareTo(thatName); } return 0; }
From source file:com.hangum.tadpole.rdb.core.viewers.object.sub.utils.TableColumnObjectQuery.java
/** * update column/*from w w w .j a v a2s . co m*/ * * @param userDB * @param tableDAO * @param tableColumnDAO * @param metaDataDao * @return * @throws Exception */ public static RequestResultDAO updateColumn(final UserDBDAO userDB, final TableDAO tableDAO, TableColumnDAO tableColumnDAO, final TableColumnUpdateDAO metaDataDao) throws Exception { RequestResultDAO addColumnResultDAO = null; String strQuery = String.format("ALTER TABLE %s CHANGE COLUMN %s %s %s %s COMMENT %s ", tableDAO.getSysName(), tableColumnDAO.getField(), metaDataDao.getColumnName(), metaDataDao.getDataType(), metaDataDao.isNotNull() ? "NOT NULL" : "NULL", SQLUtil.makeQuote(metaDataDao.getComment())); if (!"".equals(metaDataDao.getCollation())) { strQuery += String.format(" COLLATE %s ", metaDataDao.getCollation()); } if (metaDataDao.isPrimaryKey()) { strQuery += " PRIMARY KEY "; } if (metaDataDao.isAutoIncrement()) { strQuery += " auto_increment "; } else { if (!"".equals(StringUtils.trimToEmpty(metaDataDao.getDefaultValue()))) { strQuery += String.format(" DEFAULT %s ", SQLUtil.makeQuote(metaDataDao.getDefaultValue())); } } addColumnResultDAO = ExecuteDDLCommand.executSQL(userDB, strQuery); return addColumnResultDAO; }
From source file:com.egt.core.util.STP.java
public static String getStringSqlParametrizado(String patron, Object[] argumentos) { if (StringUtils.isBlank(patron)) { return null; }/*from www . j ava 2 s. c o m*/ Object[] strings = new Object[argumentos.length]; for (int i = 0; i < argumentos.length; i++) { strings[i] = argumentos[i] == null ? "null" : StringUtils.trimToEmpty(getStringSql(argumentos[i])); } return MessageFormat.format(patron, strings); }
From source file:com.prowidesoftware.swift.model.field.Field70.java
/** * Get the Narrative as a concatenation of component1 to component4. * @return the Narrative from components *///from w w w . j av a2s.c o m public String getNarrative() { StringBuilder result = new StringBuilder(); for (int i = 1; i < 5; i++) { if (StringUtils.isNotBlank(getComponent(i))) { if (result.length() > 0) { result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL); } result.append(StringUtils.trimToEmpty(getComponent(i))); } } return result.toString(); }
From source file:it.av.eatt.service.impl.JcrApplicationServiceJackrabbit.java
public void setBasePath(String basePath) { if (StringUtils.isBlank(basePath)) { this.basePath = ""; } else {/*from w ww .j a va 2s . c om*/ this.basePath = StringUtils.trimToEmpty(basePath); if ((StringUtils.endsWith(this.basePath, "/"))) { this.basePath = StringUtils.removeEnd(this.basePath, "/"); } } }
From source file:com.haulmont.cuba.web.gui.components.WebDateField.java
@Override public void setDateFormat(String dateFormat) { dateTimeFormat = dateFormat;/*w w w .j a v a 2s .c o m*/ StringBuilder date = new StringBuilder(dateFormat); StringBuilder time = new StringBuilder(dateFormat); int timeStartPos = findTimeStartPos(dateFormat); if (timeStartPos >= 0) { time.delete(0, timeStartPos); date.delete(timeStartPos, dateFormat.length()); timeFormat = StringUtils.trimToEmpty(time.toString()); timeField.setFormat(timeFormat); setResolution(resolution); } else if (resolution.ordinal() < Resolution.DAY.ordinal()) { setResolution(Resolution.DAY); } this.dateFormat = StringUtils.trimToEmpty(date.toString()); dateField.setDateFormat(this.dateFormat); }