Skip to content
Snippets Groups Projects
Commit 611be92c authored by lmihalkovic's avatar lmihalkovic
Browse files

no-jira: adding convenience methods to simplify inserting parameters inside a string

parent 0d1f0e89
No related branches found
No related tags found
No related merge requests found
......@@ -66,6 +66,9 @@ public class StringOutput extends Writer {
sb.append(val);
return this;
}
public StringOutput append(String format, Object...args) {
return appendFmt(format, args);
}
/**
*
......@@ -80,6 +83,21 @@ public class StringOutput extends Writer {
return this;
}
public StringOutput ifCond(boolean cond) {
if (cond) return this;
return new StringOutput();
}
public StringOutput appendFmt(String format, Object...params) {
if(params.length == 0) {
sb.append(format);
} else {
String v = String.format(format, params);
sb.append(v);
}
return this;
}
/**
* @param val
* @return Itself
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment