/** * Generates the string representation of the string, assuming that it is going to be used in a place that doesn't * require parenthesis. If this isn't the case consider using the {@link #toString(boolean)} method, passing the * {@code true} as the value of the {@code protect} parameter. */ @Override public String toString() { return toString(false); } }
@Override public String toString(boolean protect) { StringBuilder buffer = new StringBuilder(); if (protect) { buffer.append("("); } buffer.append(left.toString(true)); buffer.append(" "); buffer.append(operator); buffer.append(" "); buffer.append(right.toString(true)); if (protect) { buffer.append(")"); } return buffer.toString(); } }
@Override public String toString(boolean protect) { StringBuilder buffer = new StringBuilder(); if (protect) { buffer.append("("); } if (array != null) { buffer.append(array.toString(true)); } buffer.append("["); if (index != null) { buffer.append(index.toString(false)); } buffer.append("]"); if (protect) { buffer.append(")"); } return buffer.toString(); } }
@Override public String toString(boolean protect) { StringBuilder buffer = new StringBuilder(); if (target != null) { if (protect) { buffer.append("("); } buffer.append(target.toString(true)); buffer.append("."); buffer.append(attribute); if (protect) { buffer.append(")"); } } else { buffer.append(attribute); } return buffer.toString(); } }
@Override public String toString(boolean protect) { StringBuilder buffer = new StringBuilder(); if (target != null) { if (protect) { buffer.append("("); } buffer.append(target.toString(true)); buffer.append("."); buffer.append(field); if (protect) { buffer.append(")"); } } else { buffer.append(field); } return buffer.toString(); } }
@Override public String toString(boolean protect) { StringBuilder buffer = new StringBuilder(); if (target != null) { if (protect) { buffer.append("("); } buffer.append(target.toString(true)); buffer.append("."); buffer.append(link); if (protect) { buffer.append(")"); } } else { buffer.append(link); } return buffer.toString(); } }
@Override public String toString(boolean protect) { StringBuilder buffer = new StringBuilder(); if (protect) { buffer.append("("); } if (operator != null) { buffer.append(operator); if (operator == Operator.NOT) { buffer.append(" "); } } if (operand != null) { buffer.append(operand.toString(true)); } if (protect) { buffer.append(")"); } return buffer.toString(); } }
@Override public String toString(boolean protect) { StringBuilder buffer = new StringBuilder(); if (protect) { buffer.append("("); } if (target != null) { buffer.append(target.toString(true)); buffer.append("."); } if (method != null) { buffer.append(method); } buffer.append("("); boolean first = true; for (Expression parameter : parameters) { if (!first) { buffer.append(", "); } buffer.append(parameter.toString(false)); first = false; } buffer.append(")"); if (protect) { buffer.append(")"); } return buffer.toString(); } }