if (getSymbols().getEscapedDelimiter() == null) .getEscapedDelimiter(), pos - escapeOffset); if (escapePos <= pos && escapePos >= 0) + getSymbols().getEscapedDelimiter().length();
/** * Determines the relative offset of an escaped delimiter in relation to * a delimiter. Depending on the used delimiter and escaped delimiter * tokens the position where to search for an escaped delimiter is * different. If, for instance, the dot character (".") is * used as delimiter, and a doubled dot ("..") as escaped * delimiter, the escaped delimiter starts at the same position as the * delimiter. If the token "\." was used, it would start one * character before the delimiter because the delimiter character * "." is the second character in the escaped delimiter * string. This relation will be determined by this method. For this to * work the delimiter string must be contained in the escaped delimiter * string. * * @return the relative offset of the escaped delimiter in relation to a * delimiter */ private int escapeOffset() { return getSymbols().getEscapedDelimiter().indexOf( getSymbols().getPropertyDelimiter()); }
/** * Helper method that checks if the specified key starts with a property * delimiter. * * @param key the key to check * @return a flag if there is a leading delimiter */ private boolean hasLeadingDelimiter(final String key) { return key.startsWith(getSymbols().getPropertyDelimiter()) && (getSymbols().getEscapedDelimiter() == null || !key .startsWith(getSymbols().getEscapedDelimiter())); }
/** * Helper method that checks if the specified key ends with a property * delimiter. * * @param key the key to check * @return a flag if there is a trailing delimiter */ private boolean hasTrailingDelimiter(final String key) { return key.endsWith(getSymbols().getPropertyDelimiter()) && (getSymbols().getEscapedDelimiter() == null || !key .endsWith(getSymbols().getEscapedDelimiter())); }
/** * Unescapes the delimiters in the specified string. * * @param key the key to be unescaped * @return the unescaped key */ private String unescapeDelimiters(final String key) { return (getSymbols().getEscapedDelimiter() == null) ? key : StringUtils.replace(key, getSymbols() .getEscapedDelimiter(), getSymbols() .getPropertyDelimiter()); }
/** * Returns a hash code for this object. * * @return a hash code */ @Override public int hashCode() { return new HashCodeBuilder().append(getPropertyDelimiter()) .append(getEscapedDelimiter()).append(getIndexStart()) .append(getIndexEnd()).append(getAttributeStart()) .append(getAttributeEnd()).toHashCode(); }
/** * Returns a string representation for this object. This string contains the * values of all properties. * * @return a string for this object */ @Override public String toString() { return new ToStringBuilder(this) .append("propertyDelimiter", getPropertyDelimiter()) .append("escapedDelimiter", getEscapedDelimiter()) .append("indexStart", getIndexStart()) .append("indexEnd", getIndexEnd()) .append("attributeStart", getAttributeStart()) .append("attributeEnd", getAttributeEnd()).toString(); }
/** * Escapes the delimiters in the specified string. * * @param key the key to be escaped * @return the escaped key */ private String escapeDelimiters(final String key) { return (getSymbols().getEscapedDelimiter() == null || key .indexOf(getSymbols().getPropertyDelimiter()) < 0) ? key : StringUtils.replace(key, getSymbols() .getPropertyDelimiter(), getSymbols() .getEscapedDelimiter()); }
/** * Compares this object with another one. Two instances of * {@code DefaultExpressionEngineSymbols} are considered equal if all of * their properties are equal. * * @param obj the object to compare to * @return a flag whether these objects are equal */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof DefaultExpressionEngineSymbols)) { return false; } final DefaultExpressionEngineSymbols c = (DefaultExpressionEngineSymbols) obj; return new EqualsBuilder() .append(getPropertyDelimiter(), c.getPropertyDelimiter()) .append(getEscapedDelimiter(), c.getEscapedDelimiter()) .append(getIndexStart(), c.getIndexStart()) .append(getIndexEnd(), c.getIndexEnd()) .append(getAttributeStart(), c.getAttributeStart()) .append(getAttributeEnd(), c.getAttributeEnd()).isEquals(); }
/** * Creates a new instance of {@code Builder} whose properties are * initialized from the passed in {@code DefaultExpressionEngineSymbols} * object. This is useful if symbols are to be created which are similar * to the passed in instance. * * @param c the {@code DefaultExpressionEngineSymbols} object serving as * starting point for this builder */ public Builder(final DefaultExpressionEngineSymbols c) { propertyDelimiter = c.getPropertyDelimiter(); escapedDelimiter = c.getEscapedDelimiter(); indexStart = c.getIndexStart(); indexEnd = c.getIndexEnd(); attributeStart = c.getAttributeStart(); attributeEnd = c.getAttributeEnd(); }