Convert grammars to use StringBuilder as well

This commit is contained in:
Sanne Grinovero 2012-02-14 18:38:54 +00:00
parent 37dafa2a5a
commit ebd78e9bb1
6 changed files with 10 additions and 10 deletions

View File

@ -478,7 +478,7 @@ path returns [String p] {
}
: a:identifier { p = a.getText(); }
| #(DOT x=path y:identifier) {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
buf.append(x).append(".").append(y.getText());
p = buf.toString();
}

View File

@ -40,7 +40,7 @@ options {
{
// the buffer to which we write the resulting SQL.
private StringBuffer buffer = new StringBuffer();
private StringBuilder buffer = new StringBuilder();
protected void out(String text) {
buffer.append( text );

View File

@ -229,7 +229,7 @@ functionCall! { trace("functionCall"); }
*/
functionName {
trace("functionName");
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
}
: i:IDENT { buffer.append( i.getText() ); }
( DOT i2:IDENT { buffer.append( '.').append( i2.getText() ); } )* {
@ -295,7 +295,7 @@ orderingSpecification! { trace("orderingSpecification"); }
*/
simplePropertyPath {
trace("simplePropertyPath");
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
}
: i:IDENT { buffer.append( i.getText() ); }
( DOT i2:IDENT { buffer.append( '.').append( i2.getText() ); } )+ {

View File

@ -25,7 +25,7 @@ options {
{
/** the buffer resulting SQL statement is written to */
private StringBuffer buf = new StringBuffer();
private StringBuilder buf = new StringBuilder();
protected void out(String s) {
buf.append(s);
@ -71,7 +71,7 @@ options {
// moved this impl into the subclass...
}
protected StringBuffer getStringBuffer() {
protected StringBuilder getStringBuilder() {
return buf;
}

View File

@ -95,7 +95,7 @@ options {
}
public String getErrorMessage() {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
for ( Iterator iterator = errorList.iterator(); iterator.hasNext(); ) {
buf.append( (String) iterator.next() );
if ( iterator.hasNext() ) {

View File

@ -167,7 +167,7 @@ public class SqlGenerator extends SqlGeneratorBase implements ErrorReporter {
}
public String getSQL() {
return getStringBuffer().toString();
return getStringBuilder().toString();
}
@Override
@ -269,11 +269,11 @@ public class SqlGenerator extends SqlGeneratorBase implements ErrorReporter {
*/
class DefaultWriter implements SqlWriter {
public void clause(String clause) {
getStringBuffer().append( clause );
getStringBuilder().append( clause );
}
public void commaBetweenParameters(String comma) {
getStringBuffer().append( comma );
getStringBuilder().append( comma );
}
}