当前位置: 首页>>代码示例>>Java>>正文


Java StrBuilder.appendWithSeparators方法代码示例

本文整理汇总了Java中org.apache.commons.lang.text.StrBuilder.appendWithSeparators方法的典型用法代码示例。如果您正苦于以下问题:Java StrBuilder.appendWithSeparators方法的具体用法?Java StrBuilder.appendWithSeparators怎么用?Java StrBuilder.appendWithSeparators使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang.text.StrBuilder的用法示例。


在下文中一共展示了StrBuilder.appendWithSeparators方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: jpqlLoadList

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
@Authenticated
@Override
public String jpqlLoadList(String queryString) {
    try {
        Transaction tx = persistence.createTransaction();
        try {
            EntityManager em = persistence.getEntityManager();
            Query query = em.createQuery(queryString);
            QueryParser parser = QueryTransformerFactory.createParser(queryString);
            Set<String> paramNames = parser.getParamNames();
            for (String paramName : paramNames) {
                security.setQueryParam(query, paramName);
            }
            List resultList = query.getResultList();
            tx.commit();

            StrBuilder sb = new StrBuilder();
            for (Object element : resultList) {
                if (element instanceof Object[]) {
                    sb.appendWithSeparators((Object[]) element, " | ");
                } else {
                    sb.append(element);
                }
                sb.append("\n");
            }
            return sb.toString();
        } finally {
            tx.end();
        }
    } catch (Throwable e) {
        log.error("jpqlLoadList error", e);
        return ExceptionUtils.getStackTrace(e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:35,代码来源:PersistenceManager.java

示例2: toQueryString

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
/**
 * Returns a string that when fed into the query parser, produces a QueryFormat equal to this one.
 * The string returned does not contain the FORMAT keyword.
 * 
 * @return The query string.
 */
public String toQueryString() {
  StrBuilder builder = new StrBuilder();
  List<String> stringList = Lists.newArrayList();
  for (AbstractColumn col : columnPatterns.keySet()) {
    String pattern = columnPatterns.get(col);
    stringList.add(col.toQueryString() + " " + Query.stringToQueryStringLiteral(pattern));
  }
  builder.appendWithSeparators(stringList, ", ");
  return builder.toString(); 
}
 
开发者ID:dzxdzx1987,项目名称:GoogleCharts,代码行数:17,代码来源:QueryFormat.java

示例3: StrBuilder

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
/**
 * Creates a comma separated string of the query strings of the given columns.
 * 
 * @param l The list of columns.
 * 
 * @return A comma separated string of the query strings of the given columns.
 */
/* package */ static String columnListToQueryString(List<AbstractColumn> l) {
  StrBuilder builder = new StrBuilder();
  List<String> stringList = Lists.newArrayList();
  for (AbstractColumn col : l) {
    stringList.add(col.toQueryString());
  }
  builder.appendWithSeparators(stringList, ", ");
  return builder.toString();
}
 
开发者ID:dzxdzx1987,项目名称:GoogleCharts,代码行数:17,代码来源:Query.java

示例4: toQueryString

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
/**
 * Returns a string that when fed to the query parser will yield an identical Query.
 * Used mainly for debugging purposes.
 * 
 * @return The query string.
 */
public String toQueryString() {
  List<String> clauses = Lists.newArrayList();
  if (hasSelection()) {               
    clauses.add("SELECT " + selection.toQueryString());
  }
  if (hasFilter()) {
    clauses.add("WHERE " + filter.toQueryString());      
  }
  if (hasGroup()) {
    clauses.add("GROUP BY " + group.toQueryString());
  }
  if (hasPivot()) {
    clauses.add("PIVOT " + pivot.toQueryString());
  }
  if (hasSort()) {
    clauses.add("ORDER BY " + sort.toQueryString());
  }
  if (hasRowSkipping()) {
    clauses.add("SKIPPING " + rowSkipping);
  }
  if (hasRowLimit()) {
    clauses.add("LIMIT " + rowLimit);
  }
  if (hasRowOffset()) {
    clauses.add("OFFSET " + rowOffset);
  }
  if (hasLabels()) {
    clauses.add("LABEL " + labels.toQueryString());
  }
  if (hasUserFormatOptions()) {
    clauses.add("FORMAT " + userFormatOptions.toQueryString());
  }
  if (hasOptions()) {
    clauses.add("OPTIONS " + options.toQueryString());
  }
  StrBuilder result = new StrBuilder();
  result.appendWithSeparators(clauses, " ");
  return result.toString();
}
 
开发者ID:dzxdzx1987,项目名称:GoogleCharts,代码行数:46,代码来源:Query.java

示例5: toQueryString

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
/**
 * Returns a string that when fed to the query parser would produce an equal QuerySort.
 * The string returned does not contain the ORDER BY keywords.
 * 
 * @return The query string.
 */
public String toQueryString() {
  StrBuilder builder = new StrBuilder();
  List<String> stringList = Lists.newArrayList();
  for (ColumnSort colSort : sortColumns) {
    stringList.add(colSort.toQueryString());
  }
  builder.appendWithSeparators(stringList, ", ");
  return builder.toString();
}
 
开发者ID:dzxdzx1987,项目名称:GoogleCharts,代码行数:16,代码来源:QuerySort.java

示例6: toQueryString

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
/**
 * Returns a string that when fed into the query parser, produces a QueryLabels equal to this one.
 * The string returned does not contain the LABEL keyword.
 * 
 * @return The query string.
 */
public String toQueryString() {
  StrBuilder builder = new StrBuilder();
  List<String> stringList = Lists.newArrayList();
  for (AbstractColumn col : columnLabels.keySet()) {
    String label = columnLabels.get(col);
    stringList.add(col.toQueryString() + " " + Query.stringToQueryStringLiteral(label));
  }
  builder.appendWithSeparators(stringList, ", ");
  return builder.toString(); 
}
 
开发者ID:dzxdzx1987,项目名称:GoogleCharts,代码行数:17,代码来源:QueryLabels.java

示例7: appendGroupByClause

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
/**
 * Appends the GROUP BY clause of the sql query to the given string builder.
 *
 * @param query The query.
 * @param queryStringBuilder The string builder holding the string query.
 */
static void appendGroupByClause(Query query, StrBuilder queryStringBuilder) {
  if (!query.hasGroup()) {
    return;
  }
  queryStringBuilder.append("GROUP BY ");
  QueryGroup queryGroup = query.getGroup();
  List<String> groupColumnIds = queryGroup.getColumnIds();
  List<String> newColumnIds = Lists.newArrayList();
  for (String groupColumnId : groupColumnIds) {
    newColumnIds.add('`' + groupColumnId + '`');
  }
  queryStringBuilder.appendWithSeparators(newColumnIds, ", ");
  queryStringBuilder.append(" ");
}
 
开发者ID:dzxdzx1987,项目名称:GoogleCharts,代码行数:21,代码来源:SqlDataSourceHelper.java

示例8: getMessageAsString

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
/**
 * @see org.kuali.kfs.module.tem.batch.service.DataReportService#getMessageAsString(java.util.List)
 */
@Override
public String getMessageAsString(List<ErrorMessage> errorMessages){

    List<String> messageList = new ArrayList<String>();
    for (ErrorMessage error : errorMessages){
        messageList.add(MessageUtils.getErrorMessage(error));
    }
    StrBuilder builder = new StrBuilder();
    builder.appendWithSeparators(messageList, BusinessObjectReportHelper.LINE_BREAK);
   return  builder.toString();
}
 
开发者ID:kuali,项目名称:kfs,代码行数:15,代码来源:DataReportServiceImpl.java

示例9: getMessageAsString

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
protected String getMessageAsString(List<ErrorMessage> errorMessages){

        List<String> messageList = new ArrayList<String>();

        for (ErrorMessage error : errorMessages){
            messageList.add(MessageUtils.getErrorMessage(error));
        }

        StrBuilder builder = new StrBuilder();
        builder.appendWithSeparators(messageList, BusinessObjectReportHelper.LINE_BREAK);
        return  builder.toString();
    }
 
开发者ID:kuali,项目名称:kfs,代码行数:13,代码来源:AgencyStagingDataMaintainable.java

示例10: sendMessage

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
@Override
public String sendMessage(String correlationID, String message,
		ParameterResolutionContext prc) throws SenderException,
		TimeOutException {
	if (sessionKeys != null) {
		List<String> list = new ArrayList<String>();
		list.add(StringEscapeUtils.escapeCsv(message));
		StringTokenizer tokenizer = new StringTokenizer(sessionKeys, ",");
		while (tokenizer.hasMoreElements()) {
			String sessionKey = (String)tokenizer.nextElement();
			list.add(StringEscapeUtils.escapeCsv((String)prc.getSession().get(sessionKey)));
		}
		StrBuilder sb = new StrBuilder();
		sb.appendWithSeparators(list, ",");
		message = sb.toString();
	}
	String messageId = prc.getSession().getMessageId();
	if (prc != null && paramList != null
			&& paramList.findParameter("messageId") != null) {
		try {
			messageId = (String)prc.getValueMap(paramList).get("messageId");
		} catch (ParameterException e) {
			throw new SenderException("Could not resolve parameter messageId", e);
		}
	}
	return storeMessage(messageId, correlationID, new Date(), null, null, message);
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:28,代码来源:MessageStoreSender.java

示例11: appendMessages

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
private void appendMessages(Collection<String> messages, StrBuilder strBuilder, String header) {
    if (messages.size() == 0) {
        return;
    }
    if (!strBuilder.isEmpty()) {
        strBuilder.appendNewLine();
    }
    strBuilder.append(header);
    List<String> sortedMessages = Lists.newArrayList(messages);
    Collections.sort(sortedMessages);
    strBuilder.appendWithSeparators(sortedMessages, ", ");
}
 
开发者ID:collectivemedia,项目名称:celos,代码行数:13,代码来源:RecursiveFsObjectComparer.java

示例12: getActionErrorsAsString

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
private String getActionErrorsAsString() {
    StrBuilder sbf = new StrBuilder();
    sbf.appendWithSeparators(getActionErrors(), "; ");

    for (Map.Entry<String, List<String>> entry : this.getFieldErrors().entrySet()) {
        sbf.appendWithSeparators(entry.getValue(), "; ");
    }
    return sbf.toString();
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:10,代码来源:UploadProjectFilesAction.java

示例13: applyOnColumn

import org.apache.commons.lang.text.StrBuilder; //导入方法依赖的package包/类
@Override
public void applyOnColumn(DataSetRow row, ActionContext context) {
    final Map<String, String> parameters = context.getParameters();
    final String columnId = context.getColumnId();

    final Map<String, String> newColumns = ActionsUtils.getTargetColumnIds(context);

    // Set the split values in newly created columns
    final String originalValue = row.get(columnId);
    if (originalValue == null) {
        return;
    }

    Pattern pattern = context.get(PATTERN);
    Matcher matcher = pattern.matcher(originalValue);

    List<String> extractedValues = new ArrayList<>();
    while (matcher.find()) {
        for (int i = 1; i <= matcher.groupCount(); i++) {
            final String matchingValue = matcher.group(i);
            if (matchingValue != null) {
                extractedValues.add(matchingValue);
            }
        }
    }

    if (parameters.get(MODE_PARAMETER).equals(MULTIPLE_COLUMNS_MODE)) {
        for (int i = 0; i < newColumns.size(); i++) {
            if (i < extractedValues.size()) {
                row.set(newColumns.get("" + Integer.toString(i)), extractedValues.get(i));
            } else {
                // If we found less tokens than limit, we complete with empty entries
                row.set(newColumns.get("" + Integer.toString(i)), EMPTY);
            }
        }
    } else {
        StrBuilder strBuilder = new StrBuilder();
        strBuilder.appendWithSeparators(extractedValues, parameters.get(PARAMETER_SEPARATOR));
        row.set(ActionsUtils.getTargetColumnId(context), strBuilder.toString());
    }
}
 
开发者ID:Talend,项目名称:data-prep,代码行数:42,代码来源:ExtractStringTokens.java


注:本文中的org.apache.commons.lang.text.StrBuilder.appendWithSeparators方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。