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


Java S.Buffer方法代码示例

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


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

示例1: line

import org.osgl.util.S; //导入方法依赖的package包/类
private static String line(ActionContext actionContext) {
    String cmd = null;
    S.Buffer sb = S.buffer();
    for (String s : actionContext.paramKeys()) {
        if ("cmd".equals(s)) {
            cmd = actionContext.paramVal(s);
        } else if (s.startsWith("-")) {
            String val = actionContext.paramVal(s);
            if (S.notBlank(val)) {
                val = val.replaceAll("[\n\r]+", "<br/>").trim();
                if (val.contains(" ")) {
                    char quote = val.contains("\"") ? '\'' : '\\';
                    val = S.wrap(val, quote);
                }
                if (s.contains(",")) {
                    s = S.before(s, ",");
                }
                sb.append(s).append(" ").append(val).append(" ");
            }
        }
    }
    E.illegalArgumentIf(null == cmd, "cmd param required");
    return S.builder(cmd).append(" ").append(sb.toString()).toString();
}
 
开发者ID:actframework,项目名称:actframework,代码行数:25,代码来源:CliOverHttpContext.java

示例2: getRowLineBuf

import org.osgl.util.S; //导入方法依赖的package包/类
/**
 * Each string item rendering requires the border and a space on both sides.
 * 
 * 12   3   12      3  12    34 
 * +-----   +--------  +------+
 *   abc      venkat     last
 * 
 * @param colCount
 * @param colMaxLenList
 * @param data
 * @return
 */
private String getRowLineBuf(int colCount, List<Integer> colMaxLenList, String[][] data) {
	
	S.Buffer rowBuilder = S.buffer();
	int colWidth;
	
	for (int i = 0 ; i < colCount ; i ++) {
		
		colWidth = colMaxLenList.get(i) + 3;
		
		for (int j = 0; j < colWidth ; j ++) {
			if (j==0) {
				rowBuilder.append("+");
			} else if ((i+1 == colCount && j+1 == colWidth)) {//for last column close the border
				rowBuilder.append("-+");
			} else {
				rowBuilder.append("-");
			}
		}
	}
	
	return rowBuilder.append("\n").toString();
}
 
开发者ID:actframework,项目名称:actframework,代码行数:35,代码来源:SimpleASCIITableImpl.java

示例3: toStrBuffer

import org.osgl.util.S; //导入方法依赖的package包/类
@Override
protected S.Buffer toStrBuffer(S.Buffer sb) {
    S.Buffer prependix = S.newBuffer();
    if (0 != priority) {
        prependix.append("p[")
                .append(priority).append("] ");
    }
    if (!whiteList.isEmpty()) {
        prependix.append("+").append(whiteList).append(" ");
    }
    if (!blackList.isEmpty()) {
        prependix.append("-").append(blackList).append(" ");
    }

    return super.toStrBuffer(sb).prepend(prependix);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:17,代码来源:InterceptorMethodMetaInfo.java

示例4: templateContext

import org.osgl.util.S; //导入方法依赖的package包/类
public String templateContext() {
    if (null != parent) {
        if (S.notBlank(templateContext) && templateContext.length() > 1 && templateContext.startsWith("/")) {
            return templateContext;
        }
        String parentContextPath = parent.templateContext();
        if (null == templateContext) {
            return parentContextPath;
        }
        if (null == parentContextPath) {
            return templateContext;
        }
        S.Buffer sb = S.newBuffer(parentContextPath);
        if (parentContextPath.endsWith("/")) {
            sb.deleteCharAt(sb.length() - 1);
        }
        if (!templateContext.startsWith("/")) {
            sb.append("/");
        }
        sb.append(templateContext);
        return sb.toString();
    }
    return templateContext;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:25,代码来源:ControllerClassMetaInfo.java

示例5: debugChain

import org.osgl.util.S; //导入方法依赖的package包/类
private static S.Buffer debugChain(Set<BeanSpec> chain, BeanSpec last) {
    S.Buffer sb = S.buffer();
    for (BeanSpec spec : chain) {
        sb.append(spec).append(" -> ");
    }
    sb.append(last);
    return sb;
}
 
开发者ID:osglworks,项目名称:java-di,代码行数:9,代码来源:Genie.java

示例6: parseRawParamKey

import org.osgl.util.S; //导入方法依赖的package包/类
private static String[] parseRawParamKey(String rawKey) {
    List<String> list = new ArrayList<>();
    int len = rawKey.length();
    boolean inSquare = false;
    S.Buffer token = S.buffer();
    for (int i = 0; i < len; ++i) {
        char c = rawKey.charAt(i);
        switch (c) {
            case '.':
                if (inSquare) {
                    token.append(c);
                } else {
                    addTokenToList(list, token);
                }
                continue;
            case ']':
                inSquare = false;
                addTokenToList(list, token);
                continue;
            case '[':
                inSquare = true;
                addTokenToList(list, token);
                continue;
            default:
                token.append(c);

        }
    }
    addTokenToList(list, token);
    return list.toArray(new String[list.size()]);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:32,代码来源:ParamTree.java

示例7: toString

import org.osgl.util.S; //导入方法依赖的package包/类
@Override
public String toString() {
    S.Buffer sb = S.buffer(brief());
    printSubJobs(parallelJobs.jobList, "parallel jobs", sb);
    printSubJobs(followingJobs.jobList, "following jobs", sb);
    printSubJobs(precedenceJobs.jobList, "precedence jobs", sb);
    return sb.toString();
}
 
开发者ID:actframework,项目名称:actframework,代码行数:9,代码来源:Job.java

示例8: genId

import org.osgl.util.S; //导入方法依赖的package包/类
/**
 * Generate a unique ID across the cluster
 * @return generated ID
 */
public String genId() {
    S.Buffer sb = S.newBuffer();
    sb.a(longEncoder.longToStr(nodeIdProvider.nodeId()))
      .a(longEncoder.longToStr(startIdProvider.startId()))
      .a(longEncoder.longToStr(sequenceProvider.seqId()));
    return sb.toString();
}
 
开发者ID:actframework,项目名称:actframework,代码行数:12,代码来源:IdGenerator.java

示例9: evaluate

import org.osgl.util.S; //导入方法依赖的package包/类
public String evaluate(String s, Map<String, ?> map) {
    int n = 0, n0 = 0, len = s.length();
    S.Buffer sb = S.newBuffer();
    while (n > -1 && n < len) {
        n = s.indexOf("${", n);
        if (n < 0) {
            if (n0 == 0) {
                return s;
            }
            sb.append(s.substring(n0, len));
            break;
        }
        sb.append(s.substring(n0, n));
        // now search for "}"
        n += 2;
        n0 = n;
        n = s.indexOf("}", n0 + 1);
        if (n < 0) {
            logger.warn("Invalid expression found in the configuration value: %s", s);
            return s;
        }
        String expression = s.substring(n0, n);
        if (S.notBlank(expression)) {
            Object o = getConfiguration(expression, null, map);
            if (null != o) {
                sb.append(o);
            } else {
                logger.warn("Cannot find expression value for: %s", expression);
            }
        }
        n += 1;
        n0 = n;
    }
    return sb.toString();
}
 
开发者ID:actframework,项目名称:actframework,代码行数:36,代码来源:ConfigKeyHelper.java

示例10: addTokenToList

import org.osgl.util.S; //导入方法依赖的package包/类
private static void addTokenToList(List<String> list, S.Buffer token) {
    String s = token.toString();
    if (S.notEmpty(s)) {
        list.add(s);
    } else {
        LOGGER.warn("empty index encountered");
    }
    token.delete(0, s.length() + 1);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:10,代码来源:ParamTree.java

示例11: getRowDataBuf

import org.osgl.util.S; //导入方法依赖的package包/类
private String getRowDataBuf(int colCount, List<Integer> colMaxLenList, 
		String[] row, ASCIITableHeader[] headerObjs, boolean isHeader) {
	
	S.Buffer rowBuilder = S.buffer();
	String formattedData;
	int align;
	
	for (int i = 0 ; i < colCount ; i ++) {
	
		align = isHeader ? DEFAULT_HEADER_ALIGN : DEFAULT_DATA_ALIGN;
		
		if (headerObjs != null && i < headerObjs.length) {
			if (isHeader) {
				align = headerObjs[i].getHeaderAlign();
			} else {
				align = headerObjs[i].getDataAlign();
			}
		}
			 
		formattedData = i < row.length ? row[i] : ""; 
		
		//format = "| %" + colFormat.get(i) + "s ";
		formattedData = "| " + 
			getFormattedData(colMaxLenList.get(i), formattedData, align) + " ";
		
		if (i+1 == colCount) {
			formattedData += "|";
		}
		
		rowBuilder.append(formattedData);
	}
	
	return rowBuilder.append("\n").toString();
}
 
开发者ID:actframework,项目名称:actframework,代码行数:35,代码来源:SimpleASCIITableImpl.java

示例12: toString

import org.osgl.util.S; //导入方法依赖的package包/类
@Override
public String toString() {
    S.Buffer buf = S.buffer().append("resource: ").append(base);
    if (null == baseUrl) {
        buf.append("(not found)");
    }
    return buf.toString();
}
 
开发者ID:actframework,项目名称:actframework,代码行数:9,代码来源:ResourceGetter.java

示例13: appendList

import org.osgl.util.S; //导入方法依赖的package包/类
private void appendList(String label, List<?> list, S.Buffer sb) {
    if (list.isEmpty()) {
        return;
    }
    if (sb.length() > 0) {
        sb.append("\n");
    }
    sb.append(label).append("\n").append(S.join("\n", list));
}
 
开发者ID:actframework,项目名称:actframework,代码行数:10,代码来源:GroupInterceptorMetaInfo.java

示例14: toStrBuffer

import org.osgl.util.S; //导入方法依赖的package包/类
protected S.Buffer toStrBuffer(S.Buffer sb) {
    sb.append(actContextInjection).append(" ");
    sb.append(_invokeType())
            .append(_return())
            .append(fullName())
            .append("(")
            .append(_params())
            .append(")");
    return sb;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:11,代码来源:HandlerMethodMetaInfo.java

示例15: commandLine

import org.osgl.util.S; //导入方法依赖的package包/类
/**
 * Returns {@link act.handler.CliHandler#commandLine()}
 * @return the command line
 * @see act.handler.CliHandler#commandLine()
 */
public $.T2<String, String> commandLine(CommanderClassMetaInfo classMetaInfo, AppClassLoader classLoader) {
    boolean hasOptions = classMetaInfo.hasOption(classLoader);
    String firstArg = null;
    boolean hasMoreArgs = false;
    for (CommandParamMetaInfo param : params) {
        if (param.optionInfo() != null) {
            hasOptions = true;
        } else {
            if (firstArg == null) {
                firstArg = param.name();
            } else {
                hasMoreArgs = true;
            }
        }
    }
    for (FieldOptionAnnoInfo fieldOptionAnnoInfo : classMetaInfo.fieldOptionAnnoInfoList(classLoader)) {
        hasOptions = true;
        if (null == firstArg) {
            firstArg = fieldOptionAnnoInfo.fieldName();
        } else {
            hasMoreArgs = true;
        }
    }

    S.Buffer sb = S.buffer(commandName);
    if (hasOptions) {
        sb.append(" [options]");
    }
    if (null != firstArg) {
        sb.append(" ");
        sb.append("[").append(firstArg);
        if (hasMoreArgs) {
            sb.append("...");
        }
        sb.append("]");
    }
    return $.T2(sb.toString(), helpMsg());
}
 
开发者ID:actframework,项目名称:actframework,代码行数:44,代码来源:CommandMethodMetaInfo.java


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