org.parboiled.support
Class StringVar

java.lang.Object
  extended by org.parboiled.common.Reference<T>
      extended by org.parboiled.support.Var<java.lang.String>
          extended by org.parboiled.support.StringVar

public class StringVar
extends Var<java.lang.String>

Simple specialization of a Var for Strings. Provides a few convenience helper methods.


Constructor Summary
StringVar()
          Initializes a new StringVar with a null initial value.
StringVar(java.lang.String value)
          Initializes a new StringVar with the given initial value.
 
Method Summary
 boolean append(char c)
          Appends the given char.
 boolean append(java.lang.String text)
          Appends the given string.
 StringVar appended(char c)
          Appends the given char.
 StringVar appended(java.lang.String text)
          Appends the given string.
 boolean isEmpty()
          Returns true if the wrapped string is either null or empty.
 
Methods inherited from class org.parboiled.support.Var
enterFrame, exitFrame, getLevel, getName, setName, toString
 
Methods inherited from class org.parboiled.common.Reference
clear, get, getAndClear, getAndSet, isNotSet, isSet, set, setAndGet
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringVar

public StringVar()
Initializes a new StringVar with a null initial value.


StringVar

public StringVar(java.lang.String value)
Initializes a new StringVar with the given initial value.

Parameters:
value - the initial value
Method Detail

isEmpty

public boolean isEmpty()
Returns true if the wrapped string is either null or empty.

Returns:
true if the wrapped string is either null or empty

append

public boolean append(java.lang.String text)
Appends the given string. If this instance is currently uninitialized the given string is used for initialization.

Parameters:
text - the text to append
Returns:
true

appended

public StringVar appended(java.lang.String text)
Appends the given string. If this instance is currently uninitialized the given string is used for initialization.

Parameters:
text - the text to append
Returns:
this instance

append

public boolean append(char c)
Appends the given char. If this instance is currently uninitialized the given char is used for initialization.

Parameters:
c - the char to append
Returns:
true

appended

public StringVar appended(char c)
Appends the given char. If this instance is currently uninitialized the given string is used for initialization.

Parameters:
c - the char to append
Returns:
this instance