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:com.prowidesoftware.swift.model.field.Field31H.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//*ww w. j a v a 2s . c o m*/ @Override public String getValue() { final StringBuilder result = new StringBuilder(); if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent1())) { result.append(StringUtils.trimToEmpty(getComponent1())); if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent2())) { result.append(StringUtils.trimToEmpty(getComponent2())); } } else { result.append(StringUtils.trimToEmpty(getComponent3())); } return result.toString(); }
From source file:com.haulmont.cuba.security.entity.User.java
public String getCaption() { String pattern = AppContext.getProperty("cuba.user.namePattern"); if (StringUtils.isBlank(pattern)) { pattern = "{1} [{0}]"; }/* w ww . ja va2 s . c om*/ MessageFormat fmt = new MessageFormat(pattern); return StringUtils.trimToEmpty( fmt.format(new Object[] { StringUtils.trimToEmpty(login), StringUtils.trimToEmpty(name) })); }
From source file:com.prowidesoftware.swift.model.field.Field50A.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//*w w w . ja v a 2 s . co m*/ @Override public String getValue() { final StringBuilder result = new StringBuilder(); if (StringUtils.isNotEmpty(getComponent1())) { result.append("/"); result.append(StringUtils.trimToEmpty(getComponent1())); } appendInLines(result, getComponent2()); return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field70C.java
/** * Serializes the fields' components into the single string value (SWIFT format) */// w w w .j av a2 s. co m @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(":"); result.append(StringUtils.trimToEmpty(getComponent1())); result.append("//"); result.append(StringUtils.trimToEmpty(getComponent2())); appendInLines(result, 3, 5); return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field19B.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///from w w w . ja va2 s .c o m @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(":"); result.append(StringUtils.trimToEmpty(getComponent1())); result.append("//"); result.append(StringUtils.trimToEmpty(getComponent2())); result.append(StringUtils.trimToEmpty(getComponent3())); return result.toString(); }
From source file:ml.shifu.shifu.core.ConfusionMatrix.java
public ConfusionMatrix(ModelConfig modelConfig, List<ColumnConfig> columnConfigList, EvalConfig evalConfig, Object source) throws IOException { this.modelConfig = modelConfig; this.evalConfig = evalConfig; this.pathFinder = new PathFinder(modelConfig); this.lock = source; this.columnConfigList = columnConfigList; this.delimiter = Environment.getProperty(Constants.SHIFU_OUTPUT_DATA_DELIMITER, Constants.DEFAULT_DELIMITER); String[] evalScoreHeader = getEvalScoreHeader(); if (ArrayUtils.isEmpty(evalScoreHeader)) { throw new ShifuException(ShifuErrorCode.ERROR_EVAL_NO_EVALSCORE_HEADER); }/*from w w w.ja v a 2s .c o m*/ if (StringUtils.isEmpty(evalConfig.getPerformanceScoreSelector())) { throw new ShifuException(ShifuErrorCode.ERROR_EVAL_SELECTOR_EMPTY); } if (modelConfig.isRegression()) { scoreColumnIndex = getColumnIndex(evalScoreHeader, StringUtils.trimToEmpty(evalConfig.getPerformanceScoreSelector())); if (scoreColumnIndex < 0) { // the score column is not found in the header of EvalScore throw new ShifuException(ShifuErrorCode.ERROR_EVAL_SELECTOR_EMPTY); } } targetColumnIndex = getColumnIndex(evalScoreHeader, StringUtils.trimToEmpty(modelConfig.getTargetColumnName(evalConfig))); if (targetColumnIndex < 0) { // the target column is not found in the header of EvalScore throw new ShifuException(ShifuErrorCode.ERROR_EVAL_TARGET_NOT_FOUND); } weightColumnIndex = getColumnIndex(evalScoreHeader, StringUtils.trimToEmpty(evalConfig.getDataSet().getWeightColumnName())); // only works for multi classification multiClassScore1Index = targetColumnIndex + 2; // target, weight, score1, score2, this is hard code try { multiClassModelCnt = ModelSpecLoaderUtils.getBasicModelsCnt(modelConfig, evalConfig, evalConfig.getDataSet().getSource()); } catch (FileNotFoundException e) { multiClassModelCnt = 0; } if (modelConfig.isClassification()) { if (modelConfig.getTrain().isOneVsAll()) { if (modelConfig.getTags().size() == 2) { // onevsall, modelcnt is 1 multiClassModelCnt = 1; } else { multiClassModelCnt = modelConfig.getTags().size(); } } else { multiClassModelCnt = 1; } } // Number of meta columns metaColumns = evalConfig.getAllMetaColumns(modelConfig).size(); posTags = new HashSet<String>(modelConfig.getPosTags(evalConfig)); negTags = new HashSet<String>(modelConfig.getNegTags(evalConfig)); scoreScale = Double.parseDouble( Environment.getProperty(Constants.SHIFU_SCORE_SCALE, Integer.toString(Scorer.DEFAULT_SCORE_SCALE))); }
From source file:com.prowidesoftware.swift.model.field.Field26C.java
/** * Serializes the fields' components into the single string value (SWIFT format) */// w w w .ja v a 2 s . c o m @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(StringUtils.trimToEmpty(getComponent1())); result.append("/"); result.append(StringUtils.trimToEmpty(getComponent2())); result.append("/"); result.append(StringUtils.trimToEmpty(getComponent3())); result.append(StringUtils.trimToEmpty(getComponent4())); result.append(StringUtils.trimToEmpty(getComponent5())); return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field98J.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///from ww w. j ava 2s . c o m @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(":"); result.append(StringUtils.trimToEmpty(getComponent1())); result.append("//"); result.append(StringUtils.trimToEmpty(getComponent2())); result.append("//"); result.append(StringUtils.trimToEmpty(getComponent3())); result.append(StringUtils.trimToEmpty(getComponent4())); return result.toString(); }
From source file:com.hangum.tadpole.rdb.core.viewers.object.sub.utils.TableColumnObjectQuery.java
/** * ? . /*from ww w . j av a2 s . c o m*/ * * @param userDB * @param tableDAO * @param metaDataDao */ public static RequestResultDAO addColumn(final UserDBDAO userDB, final TableDAO tableDAO, final TableColumnUpdateDAO metaDataDao) throws Exception { RequestResultDAO addColumnResultDAO = null; String strQuery = String.format("ALTER TABLE %s ADD COLUMN %s %s %s COMMENT %s ", tableDAO.getSysName(), 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); //$NON-NLS-1$ return addColumnResultDAO; }
From source file:com.hangum.tadpole.rdb.core.dialog.dbconnect.AbstractLoginComposite.java
/** * combo message//w w w . j a va 2 s .c o m * * @param text * @param msg * @return */ protected boolean message(Combo text, String msg) { if ("".equals(StringUtils.trimToEmpty(text.getText()))) { //$NON-NLS-1$ MessageDialog.openError(null, Messages.DBLoginDialog_10, msg + Messages.MySQLLoginComposite_10); text.setFocus(); return false; } return true; }