本文整理汇总了Java中org.apache.commons.lang3.text.StrBuilder.appendWithSeparators方法的典型用法代码示例。如果您正苦于以下问题:Java StrBuilder.appendWithSeparators方法的具体用法?Java StrBuilder.appendWithSeparators怎么用?Java StrBuilder.appendWithSeparators使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.text.StrBuilder
的用法示例。
在下文中一共展示了StrBuilder.appendWithSeparators方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFunctionCall
import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
public static String buildFunctionCall(String funcName, String ... args) {
StrBuilder funcCallBuilder = new StrBuilder(funcName);
funcCallBuilder.append(CALL_PREFIX);
funcCallBuilder.appendWithSeparators(args, ITEM_DELIM);
funcCallBuilder.append(CALL_SUFFIX);
return funcCallBuilder.build();
}
示例2: buildSelectQuery
import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
public static <T> OSQLSynchQuery<T> buildSelectQuery(Class<T> targetClass, @Nullable String targetClassName, @Nullable List<String> projections,
Map<String, String> params, @Nullable String groupByFieldName) {
StrBuilder queryBuilder = new StrBuilder(SELECT_CMD);
queryBuilder.append(StringUtils.SPACE);
if (!CollectionUtils.isEmpty(projections)) {
queryBuilder.appendWithSeparators(projections, ITEM_DELIM);
queryBuilder.append(StringUtils.SPACE);
}
queryBuilder.append(FROM_OP);
queryBuilder.append(StringUtils.SPACE);
queryBuilder.append(((targetClassName != null) ? targetClassName : targetClass.getSimpleName()));
queryBuilder.append(StringUtils.SPACE);
if (!MapUtils.isEmpty(params)) {
queryBuilder.append(WHERE_OP);
String[] paramNames = params.keySet().toArray(new String[params.size()]);
for (int a = 0; a < paramNames.length; a++) {
queryBuilder.append(StringUtils.SPACE);
if (a > 0) {
queryBuilder.append(AND_OP);
queryBuilder.append(StringUtils.SPACE);
}
queryBuilder.append(paramNames[a]);
queryBuilder.append(StringUtils.SPACE);
if (params.get(paramNames[a]) != null) {
queryBuilder.append(EQ_OP);
queryBuilder.append(StringUtils.SPACE);
queryBuilder.append(PARAM_PREFIX);
queryBuilder.append(paramNames[a]);
} else {
queryBuilder.append(IS_OP);
queryBuilder.append(StringUtils.SPACE);
queryBuilder.append(NULL_VALUE);
}
}
}
if (groupByFieldName != null) {
queryBuilder.append(StringUtils.SPACE);
queryBuilder.append(GROUP_OP);
queryBuilder.append(StringUtils.SPACE);
queryBuilder.append(BY_OP);
queryBuilder.append(StringUtils.SPACE);
queryBuilder.append(groupByFieldName);
}
return new OSQLSynchQuery<>(queryBuilder.build());
}