/** * {@inheritDoc} This implementation checks whether the object to be escaped * is a string. If yes, it delegates to {@link #escapeString(String)}, * otherwise no escaping is performed. Eventually, the passed in transformer * is invoked so that additional encoding can be performed. */ @Override public Object escape(final Object value, final ValueTransformer transformer) { final Object escValue = (value instanceof String) ? escapeString((String) value) : value; return transformer.transformValue(escValue); }
/** * Escapes the given property value. This method is called on saving the * configuration for each property value. It ensures a correct handling of * backslash characters and also takes care that list delimiter characters * in the value are escaped. * * @param value the property value * @param inList a flag whether the value is part of a list * @param transformer the {@code ValueTransformer} * @return the escaped property value */ protected String escapeValue(final Object value, final boolean inList, final ValueTransformer transformer) { String escapedValue = String.valueOf(transformer.transformValue(escapeBackslashs( value, inList))); if (getDelimiter() != 0) { escapedValue = StringUtils.replace(escapedValue, String.valueOf(getDelimiter()), ESCAPE + getDelimiter()); } return escapedValue; }