Java Code Examples for org.apache.commons.lang3.text.StrBuilder#toString()

The following examples show how to use org.apache.commons.lang3.text.StrBuilder#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Runner.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * List available algorithms. This is displayed to the user when no valid
 * algorithm is given in the program parameterization.
 *
 * @return usage string listing available algorithms
 */
private static String getAlgorithmsListing() {
	StrBuilder strBuilder = new StrBuilder();

	strBuilder
		.appendNewLine()
		.appendln("Select an algorithm to view usage: flink run examples/flink-gelly-examples_<version>.jar --algorithm <algorithm>")
		.appendNewLine()
		.appendln("Available algorithms:");

	for (Driver algorithm : driverFactory) {
		strBuilder.append("  ")
			.appendFixedWidthPadRight(algorithm.getName(), 30, ' ')
			.append(algorithm.getShortDescription()).appendNewLine();
	}

	return strBuilder.toString();
}
 
Example 2
Source File: Runner.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * List available algorithms. This is displayed to the user when no valid
 * algorithm is given in the program parameterization.
 *
 * @return usage string listing available algorithms
 */
private static String getAlgorithmsListing() {
	StrBuilder strBuilder = new StrBuilder();

	strBuilder
		.appendNewLine()
		.appendln("Select an algorithm to view usage: flink run examples/flink-gelly-examples_<version>.jar --algorithm <algorithm>")
		.appendNewLine()
		.appendln("Available algorithms:");

	for (Driver algorithm : driverFactory) {
		strBuilder.append("  ")
			.appendFixedWidthPadRight(algorithm.getName(), 30, ' ')
			.append(algorithm.getShortDescription()).appendNewLine();
	}

	return strBuilder.toString();
}
 
Example 3
Source File: Runner.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * List available algorithms. This is displayed to the user when no valid
 * algorithm is given in the program parameterization.
 *
 * @return usage string listing available algorithms
 */
private static String getAlgorithmsListing() {
	StrBuilder strBuilder = new StrBuilder();

	strBuilder
		.appendNewLine()
		.appendln("Select an algorithm to view usage: flink run examples/flink-gelly-examples_<version>.jar --algorithm <algorithm>")
		.appendNewLine()
		.appendln("Available algorithms:");

	for (Driver algorithm : driverFactory) {
		strBuilder.append("  ")
			.appendFixedWidthPadRight(algorithm.getName(), 30, ' ')
			.append(algorithm.getShortDescription()).appendNewLine();
	}

	return strBuilder.toString();
}
 
Example 4
Source File: AbstractReader.java    From swagger-maven-plugin with Apache License 2.0 6 votes vote down vote up
protected String getOperationId(Method method, String httpMethod) {
if (this.operationIdFormat == null) {
	this.operationIdFormat = OPERATION_ID_FORMAT_DEFAULT;
}

String packageName = method.getDeclaringClass().getPackage().getName();
String className = method.getDeclaringClass().getSimpleName();
String methodName = method.getName();
    
StrBuilder sb = new StrBuilder(this.operationIdFormat);
sb.replaceAll("{{packageName}}", packageName);
sb.replaceAll("{{className}}", className);
sb.replaceAll("{{methodName}}", methodName);
sb.replaceAll("{{httpMethod}}", httpMethod);

return sb.toString();
}
 
Example 5
Source File: ParameterizedBase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public String getUsage() {
	StrBuilder strBuilder = new StrBuilder();

	// print parameters as ordered list
	for (Parameter<?> parameter : parameters) {
		if (!parameter.isHidden()) {
			strBuilder
				.append(parameter.getUsage())
				.append(" ");
		}
	}

	return strBuilder.toString();
}
 
Example 6
Source File: ParameterizedBase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public String getUsage() {
	StrBuilder strBuilder = new StrBuilder();

	// print parameters as ordered list
	for (Parameter<?> parameter : parameters) {
		if (!parameter.isHidden()) {
			strBuilder
				.append(parameter.getUsage())
				.append(" ");
		}
	}

	return strBuilder.toString();
}
 
Example 7
Source File: TokenServiceImpl.java    From SpringBoot-Home with Apache License 2.0 5 votes vote down vote up
@Override
public String createToken() {
    String str = RandomUtil.UUID32();
    StrBuilder token = new StrBuilder();
    token.append(Constant.Redis.TOKEN_PREFIX).append(str);

    jedisUtil.set(token.toString(), token.toString(), Constant.Redis.EXPIRE_TIME_MINUTE);

    return token.toString();
}
 
Example 8
Source File: TrieImpl.java    From gsc-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String dumpTrie(boolean compact) {
    if (root == null) {
        return "<empty>";
    }
    encode();
    StrBuilder ret = new StrBuilder();
    List<String> strings = root.dumpTrieNode(compact);
    ret.append("Root: " + hash2str(getRootHash(), compact) + "\n");
    for (String s : strings) {
        ret.append(s).append('\n');
    }
    return ret.toString();
}
 
Example 9
Source File: TrieImpl.java    From nuls with MIT License 5 votes vote down vote up
public String dumpTrie(boolean compact) {
    if (root == null) {
        return "<empty>";
    }
    encode();
    StrBuilder ret = new StrBuilder();
    List<String> strings = root.dumpTrieNode(compact);
    ret.append("Root: " + hash2str(getRootHash(), compact) + "\n");
    for (String s : strings) {
        ret.append(s).append('\n');
    }
    return ret.toString();
}
 
Example 10
Source File: AO_TargetExt.java    From svg2vector with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a long description with supported targets.
 * @param descr original long description
 * @param supportedTargets targets
 * @return long description with added list of supported targets
 * @throws NullPointerException if argument was null
 * @throw IllegalArgumentException if target had null elements
 */
protected static String buildLongDescr(String descr, SvgTargets[] supportedTargets){
	Validate.notNull(supportedTargets);
	Validate.noNullElements(supportedTargets);

	StrBuilder ret = new StrBuilder();
	ret.append(descr);
	ret.append(" Supported targets are: ").appendWithSeparators(supportedTargets, ", ");
	return ret.toString();
}
 
Example 11
Source File: ParameterizedBase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public String getUsage() {
	StrBuilder strBuilder = new StrBuilder();

	// print parameters as ordered list
	for (Parameter<?> parameter : parameters) {
		if (!parameter.isHidden()) {
			strBuilder
				.append(parameter.getUsage())
				.append(" ");
		}
	}

	return strBuilder.toString();
}
 
Example 12
Source File: BatchPage.java    From appstatus with Apache License 2.0 5 votes vote down vote up
private String generateClearActions() throws IOException {
	StrBuilder sb = new StrBuilder();
	sb.append("<p>Actions :</p><form action='?p=batch' method='post'><input type='submit' name='" + CLEAR_OLD //
			+ "' value='Delete old (6 months)' class='btn'/> <input type='submit' name='" + CLEAR_SUCCESS //
			+ "' value='Delete Success w/o rejected' class='btn'/></form>");
	return sb.toString();
}
 
Example 13
Source File: AppProperties.java    From svg2vector with Apache License 2.0 4 votes vote down vote up
/**
 * Set output and do all tests for layer processing.
 * @param target the set target
 * @return null on success, error message on error
 */
private String setOutputWithLayers(SvgTargets target){
	//warnings first
	for(ApplicationOption<?> ao : this.withLayersWarnings){
		if(ao.inCli()){
			this.warnings.add("layers processed but CLI option <" + ao.getCliOption().getLongOpt() + "> used, will be ignored");
		}
	}

	String dout = this.aoDirOut.getValue();
	File testDir = new File(dout);
	if(testDir.exists() && !testDir.isDirectory()){
		return "output directory <" + dout + "> exists but is not a directory";
	}
	if(testDir.exists() && !testDir.canWrite()){
		return "output directory <" + dout + "> exists but cannot write into it, check permissions";
	}
	if(!testDir.exists() && !this.aoCreateDirs.inCli()){
		return "output directory <" + dout + "> does not exist and CLI option <" + this.aoCreateDirs.getCliOption().getLongOpt() + "> not used";
	}

	if(!this.aoFoutLayerId.inCli() && !this.aoFoutLayerIndex.inCli()){
		return "processing layers but neither <" + this.aoFoutLayerId.getCliOption().getLongOpt() + "> nor <" + this.aoFoutLayerIndex.getCliOption().getLongOpt() + "> options requestes, amigious output file names";
	}

	StrBuilder pattern = new StrBuilder();
	pattern.append(dout);
	if(!pattern.endsWith("/")){
		pattern.append('/');
	}

	if(!this.aoFoutNoBasename.inCli()){
		if(this.aoUseBaseName.inCli()){
			pattern.append(this.aoUseBaseName.getValue());
		}
		else{
			String bn = StringUtils.substringAfterLast(this.fin, "/");
			bn = StringUtils.substringBeforeLast(bn, ".");
			pattern.append(bn);
		}
	}


	if(this.aoFoutLayerIndex.inCli()){
		if(!pattern.endsWith("/")){
			pattern.append('-');
		}
		pattern.append(SUBST_PATTERN_INDEX);
	}

	if(this.aoFoutLayerId.inCli()){
		if(!pattern.endsWith("/")){
			pattern.append('-');
		}
		pattern.append(SUBST_PATTERN_ID);
	}

	this.dout = dout;
	this.doutFile = testDir;
	this.foutPattern = pattern.toString();
	return null;
}