/** * Parses the specified string representation to create a list of categories. * @param aValue a string representation of a list of categories */ public TextList(final String aValue) { texts = new CopyOnWriteArrayList<String>(); final Pattern pattern = Pattern.compile("(?:\\\\.|[^\\\\,]++)+"); final Matcher matcher = pattern.matcher(aValue); while (matcher.find()){ texts.add(Strings.unescape(matcher.group().replace("\\\\","\\"))); } }
/** * {@inheritDoc} */ public final String toString() { return texts.stream().map(t -> Strings.escape(t)).collect(Collectors.joining(",")); }
/** * Convenience method for replacing escaped special characters * with their original form. * @param aValue a string value to unescape * @return a string representation of the specified * string with escaped characters replaced with their * original form */ public static String unescape(final String aValue) { return unescapeBackslash(unescapeNewline(unescapePunctuation(aValue))); }
/** * Convenience method for escaping special characters. * @param aValue a string value to escape * @return an escaped representation of the specified * string */ public static String escape(final String aValue) { return escapePunctuation(escapeNewline(escapeBackslash(aValue))); }
/** * {@inheritDoc} */ public final String toString() { final StringBuffer buffer = new StringBuffer(); buffer.append(getName()); if (getParameters() != null) { buffer.append(getParameters()); } buffer.append(':'); if (this instanceof Escapable) { buffer.append(Strings.escape(Strings.valueOf(getValue()))); } else { buffer.append(Strings.valueOf(getValue())); } buffer.append(Strings.LINE_SEPARATOR); return buffer.toString(); }
/** * {@inheritDoc} */ public String getValue() { return Strings.valueOf(dates); }
/** * @param aValue a string representation of a scheduling agent */ public ScheduleAgent(final String aValue) { super(SCHEDULE_AGENT, new Factory()); this.value = Strings.unquote(aValue); }
public ParameterBuilder value(String value) { this.value = Strings.escapeNewline(value); return this; }
/** * Convenience method for replacing escaped special characters * with their original form. * @param aValue a string value to unescape * @return a string representation of the specified * string with escaped characters replaced with their * original form */ public static String unescape(final String aValue) { return unescapeBackslash(unescapeNewline(unescapePunctuation(aValue))); }
/** * Convenience method for escaping special characters. * @param aValue a string value to escape * @return an escaped representation of the specified * string */ public static String escape(final String aValue) { return escapePunctuation(escapeNewline(escapeBackslash(aValue))); }
/** * Indicates whether the current parameter value should be quoted. * * @return true if the value should be quoted, otherwise false */ protected boolean isQuotable() { return Strings.PARAM_QUOTE_PATTERN.matcher(Strings.valueOf(getValue())) .find(); }
/** * @param aValue a string representation of Delegatees * @throws URISyntaxException when the specified string is not a valid list of cal-addresses */ public DelegatedTo(final String aValue) throws URISyntaxException { this(new AddressList(Strings.unquote(aValue))); }
public ParameterBuilder value(String value) { this.value = Strings.escapeNewline(value); return this; }
/** * Parses the specified string representation to create a list of categories. * @param aValue a string representation of a list of categories */ public TextList(final String aValue) { texts = new CopyOnWriteArrayList<String>(); final Pattern pattern = Pattern.compile("(?:\\\\.|[^\\\\,]++)+"); final Matcher matcher = pattern.matcher(aValue); while (matcher.find()){ texts.add(Strings.unescape(matcher.group().replace("\\\\","\\"))); } }
/** * Convenience method for replacing escaped special characters * with their original form. * @param aValue a string value to unescape * @return a string representation of the specified * string with escaped characters replaced with their * original form */ public static String unescape(final String aValue) { return unescapeBackslash(unescapeNewline(unescapePunctuation(aValue))); }