if (stateObject.isDecorated()) {
toText(stateObject);
}
else {
LikeExpression expression = stateObject.getExpression();
// String expression
if (stateObject.hasStringStateObject()) {
stateObject.getStringStateObject().accept(this);
}
if (shouldOutput(expression) || expression.hasSpaceAfterStringExpression()) {
writer.append(SPACE);
}
// 'NOT'
if (stateObject.hasNot()) {
appendIdentifier((expression != null) ? expression.getActualNotIdentifier() : NOT, NOT);
writer.append(SPACE);
}
// 'LIKE'
appendIdentifier((expression != null) ? expression.getActualLikeIdentifier() : LIKE, LIKE);
if (shouldOutput(expression) || expression.hasSpaceAfterLike()) {
writer.append(SPACE);
}
// Pattern value
if (stateObject.hasPatternValue()) {
stateObject.getPatternValue().accept(this);
}
if (exactMatch && (expression != null) && expression.hasSpaceAfterPatternValue()) {
writer.append(SPACE);
}
// Escape character
if (stateObject.hasEscapeCharacter()) {
if (!exactMatch) {
writer.append(SPACE);
}
appendIdentifier((expression != null) ? expression.getActualEscapeIdentifier() : ESCAPE, ESCAPE);
if (shouldOutput(expression) || expression.hasSpaceAfterEscape()) {
writer.append(SPACE);
}
writer.append(stateObject.getEscapeCharacter());
}