switch (c[pos.getIndex()]) { case QUOTE: appendQuotedString(pattern, pos, stripCustom, true); break; case START_FE: fmtCount++; seekNonWs(pattern, pos); int start = pos.getIndex(); int index = readArgumentIndex(pattern, next(pos)); stripCustom.append(START_FE).append(index); seekNonWs(pattern, pos); Format format = null; String formatDescription = null; if (c[pos.getIndex()] == START_FMT) { formatDescription = parseFormatDescription(pattern, next(pos)); format = getFormat(formatDescription); if (format == null) { stripCustom.append(START_FMT).append(formatDescription); next(pos); toPattern = insertFormats(super.toPattern(), foundDescriptions); if (containsElements(foundFormats)) { Format[] origFormats = getFormats();
/** * Create a new ExtendedMessageFormat. * * @param pattern the pattern to use, not null * @param locale the locale to use, not null * @param registry the registry of format factories, may be null * @throws IllegalArgumentException in case of a bad pattern. */ public ExtendedMessageFormat(String pattern, Locale locale, Map registry) { super(DUMMY_PATTERN); setLocale(locale); this.registry = registry; applyPattern(pattern); }
/** * Get a custom format from a format description. * * @param desc String * @return Format */ private Format getFormat(String desc) { if (registry != null) { String name = desc; String args = null; int i = desc.indexOf(START_FMT); if (i > 0) { name = desc.substring(0, i).trim(); args = desc.substring(i + 1).trim(); } FormatFactory factory = (FormatFactory) registry.get(name); if (factory != null) { return factory.getFormat(name, args, getLocale()); } } return null; }
seekNonWs(pattern, pos); int text = pos.getIndex(); int depth = 1; for (; pos.getIndex() < pattern.length(); next(pos)) { switch (pattern.charAt(pos.getIndex())) { case START_FE: getQuotedString(pattern, pos, false); break;
seekNonWs(pattern, pos); StrBuilder result = new StrBuilder(); boolean error = false; for (; !error && pos.getIndex() < pattern.length(); next(pos)) { char c = pattern.charAt(pos.getIndex()); if (Character.isWhitespace(c)) { seekNonWs(pattern, pos); c = pattern.charAt(pos.getIndex()); if (c != START_FMT && c != END_FE) {
if (!containsElements(customPatterns)) { return pattern; switch (c) { case QUOTE: appendQuotedString(pattern, pos, sb, false); break; case START_FE: fe++; sb.append(START_FE).append( readArgumentIndex(pattern, next(pos))); String customPattern = (String) customPatterns.get(fe); if (customPattern != null) { next(pos);
/** * Consume quoted string only * * @param pattern pattern to parse * @param pos current parse position * @param escapingOn whether to process escaped quotes */ private void getQuotedString(String pattern, ParsePosition pos, boolean escapingOn) { appendQuotedString(pattern, pos, null, escapingOn); }
if (!containsElements(customPatterns)) { return pattern; switch (c) { case QUOTE: appendQuotedString(pattern, pos, sb, false); break; case START_FE: fe++; sb.append(START_FE).append( readArgumentIndex(pattern, next(pos))); String customPattern = (String) customPatterns.get(fe); if (customPattern != null) { next(pos);
seekNonWs(pattern, pos); int text = pos.getIndex(); int depth = 1; for (; pos.getIndex() < pattern.length(); next(pos)) { switch (pattern.charAt(pos.getIndex())) { case START_FE: getQuotedString(pattern, pos, false); break;
seekNonWs(pattern, pos); StringBuffer result = new StringBuffer(); boolean error = false; for (; !error && pos.getIndex() < pattern.length(); next(pos)) { char c = pattern.charAt(pos.getIndex()); if (Character.isWhitespace(c)) { seekNonWs(pattern, pos); c = pattern.charAt(pos.getIndex()); if (c != START_FMT && c != END_FE) {
/** * Consume quoted string only * * @param pattern pattern to parse * @param pos current parse position * @param escapingOn whether to process escaped quotes */ private void getQuotedString(String pattern, ParsePosition pos, boolean escapingOn) { appendQuotedString(pattern, pos, null, escapingOn); }
switch (c[pos.getIndex()]) { case QUOTE: appendQuotedString(pattern, pos, stripCustom, true); break; case START_FE: fmtCount++; seekNonWs(pattern, pos); int start = pos.getIndex(); int index = readArgumentIndex(pattern, next(pos)); stripCustom.append(START_FE).append(index); seekNonWs(pattern, pos); Format format = null; String formatDescription = null; if (c[pos.getIndex()] == START_FMT) { formatDescription = parseFormatDescription(pattern, next(pos)); format = getFormat(formatDescription); if (format == null) { stripCustom.append(START_FMT).append(formatDescription); next(pos); toPattern = insertFormats(super.toPattern(), foundDescriptions); if (containsElements(foundFormats)) { Format[] origFormats = getFormats();
if (!containsElements(customPatterns)) { return pattern; switch (c) { case QUOTE: appendQuotedString(pattern, pos, sb, false); break; case START_FE: fe++; sb.append(START_FE).append( readArgumentIndex(pattern, next(pos))); String customPattern = (String) customPatterns.get(fe); if (customPattern != null) { next(pos);
seekNonWs(pattern, pos); int text = pos.getIndex(); int depth = 1; for (; pos.getIndex() < pattern.length(); next(pos)) { switch (pattern.charAt(pos.getIndex())) { case START_FE: getQuotedString(pattern, pos, false); break;
/** * Create a new ExtendedMessageFormat. * * @param pattern the pattern to use, not null * @param locale the locale to use, not null * @param registry the registry of format factories, may be null * @throws IllegalArgumentException in case of a bad pattern. */ public ExtendedMessageFormat(String pattern, Locale locale, Map registry) { super(DUMMY_PATTERN); setLocale(locale); this.registry = registry; applyPattern(pattern); }
seekNonWs(pattern, pos); StringBuffer result = new StringBuffer(); boolean error = false; for (; !error && pos.getIndex() < pattern.length(); next(pos)) { char c = pattern.charAt(pos.getIndex()); if (Character.isWhitespace(c)) { seekNonWs(pattern, pos); c = pattern.charAt(pos.getIndex()); if (c != START_FMT && c != END_FE) {
/** * Consume quoted string only * * @param pattern pattern to parse * @param pos current parse position * @param escapingOn whether to process escaped quotes */ private void getQuotedString(String pattern, ParsePosition pos, boolean escapingOn) { appendQuotedString(pattern, pos, null, escapingOn); }
/** * Get a custom format from a format description. * * @param desc String * @return Format */ private Format getFormat(String desc) { if (registry != null) { String name = desc; String args = null; int i = desc.indexOf(START_FMT); if (i > 0) { name = desc.substring(0, i).trim(); args = desc.substring(i + 1).trim(); } FormatFactory factory = (FormatFactory) registry.get(name); if (factory != null) { return factory.getFormat(name, args, getLocale()); } } return null; }