Java Code Examples for com.fasterxml.jackson.core.util.BufferRecyclers#getJsonStringEncoder()

The following examples show how to use com.fasterxml.jackson.core.util.BufferRecyclers#getJsonStringEncoder() . 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: CodeRange.java    From RefactoringMiner with MIT License 5 votes vote down vote up
private String escapeQuotes(String s) {
	if(s != null) {
		StringBuilder sb = new StringBuilder();
		JsonStringEncoder encoder = BufferRecyclers.getJsonStringEncoder();
		encoder.quoteAsString(s, sb);
		return sb.toString();
	}
	return s;
}
 
Example 2
Source File: Refactoring.java    From RefactoringMiner with MIT License 5 votes vote down vote up
default public String toJSON() {
	StringBuilder sb = new StringBuilder();
	JsonStringEncoder encoder = BufferRecyclers.getJsonStringEncoder();
	sb.append("{").append("\n");
	sb.append("\t").append("\"").append("type").append("\"").append(": ").append("\"").append(getName()).append("\"").append(",").append("\n");
	sb.append("\t").append("\"").append("description").append("\"").append(": ").append("\"");
	encoder.quoteAsString(toString().replace('\t', ' '), sb);
	sb.append("\"").append(",").append("\n");
	sb.append("\t").append("\"").append("leftSideLocations").append("\"").append(": ").append(leftSide()).append(",").append("\n");
	sb.append("\t").append("\"").append("rightSideLocations").append("\"").append(": ").append(rightSide()).append("\n");
	sb.append("}");
	return sb.toString();
}
 
Example 3
Source File: JsonStringEncoder.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Factory method for getting an instance; this is either recycled per-thread instance,
 * or a newly constructed one.
 *
 * @deprecated Since 2.9.2 use {@link BufferRecyclers#getJsonStringEncoder()} instead
 */
@Deprecated
public static JsonStringEncoder getInstance() {
    return BufferRecyclers.getJsonStringEncoder();
}