public abstract class InvalidTokenTranslator extends Object implements TokenTranslator
Modifier and Type | Field and Description |
---|---|
protected int |
behaviour
Flag specifying how the translator will deal with illegal tokens.
|
protected String |
empty
Representation of the empty string; truly empty by default.
|
static int |
RETURN_EMPTY_STRING
Specifies translation behaviour where invalid tokens will be translated
to an empty string.
|
static int |
RETURN_NULL
Specifies translation behaviour where invalid tokens will be translated
to a null value.
|
static int |
RETURN_TOKEN_STRING
Specifies translation behaviour where invalid tokens will be translated
to the token string itself, i.e.
|
Constructor and Description |
---|
InvalidTokenTranslator()
Constructs a translator that will translate illegal tokens to null
values.
|
InvalidTokenTranslator(int behaviour)
Constructs a translator that will treat illegal tokens according to the
given behaviour.
|
Modifier and Type | Method and Description |
---|---|
int |
getBehaviour()
Returns true if the translator will allow illegal tokens.
|
String |
getEmptyString()
Sets the value of the empty string to be used in lieu of the invalid
token.
|
void |
setBehaviour(int behaviour)
Sets the behaviour for treatment of illegal tokens.
|
void |
setEmptyString(String empty)
Sets the value of the empty string to be used in lieu of the invalid
token.
|
String |
translateInvalidToken(String token)
Translates the illegal token into its value depending on the currently
configured mode of behaviour.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
translate
public static final int RETURN_NULL
public static final int RETURN_EMPTY_STRING
public static final int RETURN_TOKEN_STRING
protected int behaviour
protected String empty
public InvalidTokenTranslator()
public InvalidTokenTranslator(int behaviour)
behaviour
- behaviour of dealing with illegal tokenspublic int getBehaviour()
public void setBehaviour(int behaviour)
behaviour
- behaviour of dealing with illegal tokenspublic String getEmptyString()
public void setEmptyString(String empty)
empty
- new 'empty' string valueCopyright © 2016. All Rights Reserved.