public String toText(ResourceBundle bundle) { return toText(bundle, false, false); } public String toText(ResourceBundle bundle, boolean hideLocation, boolean hidePath) {
public Message message(String key, String format, Object... arguments) { return new Message(key, format, arguments); }
public String toXML() { return toXML(null, false, false, false); } public String toXML(ResourceBundle bundle, boolean hideLocation, boolean hidePath, boolean showSource) {
public String toXML(ResourceBundle bundle, boolean hideLocation, boolean hidePath, boolean showSource) { StringBuffer sb = new StringBuffer(); sb.append("<message>\n"); sb.append(toXMLKey()); sb.append(toXMLText(bundle)); sb.append("</message>\n"); return sb.toString(); } private static final String placeholderKey = "*KEY*";
public String toXMLText(ResourceBundle bundle) { StringBuffer sb = new StringBuffer(); String text = toText(bundle); if ((text != null) && (text.length() > 0)) { StringBuffer sbText = new StringBuffer(text); String reference = extractReference(sbText, true); sb.append("<text>"); sb.append(escapeText(sbText.toString())); sb.append("</text>\n"); if ((reference != null) && (reference.length() > 0)) { sb.append("<reference>"); sb.append(escapeText(reference)); sb.append("</reference>\n"); } } return sb.toString(); } private static final Pattern xsdPattern = Pattern.compile("(XSD\\([^\\)]*\\)): .*");
public String toXMLKey() { StringBuffer sb = new StringBuffer(); String key = this.key; if ((key != null) && (key.length() > 0)) { if (!key.equals(placeholderKey) && !key.equals(placeholderNoKey)) { sb.append("<key>"); sb.append(escapeText(key)); sb.append("</key>\n"); } } return sb.toString(); } public String toXMLText(ResourceBundle bundle) {
public InvalidOptionUsageException(String option, Message message) { this(option, message.toText()); } }
@Override protected void out(ReportType reportType, Message message) { String type; if (reportType == ReportType.Error) type = "error"; else if (reportType == ReportType.Warning) type = "warning"; else if (reportType == ReportType.Info) type = "info"; else if (reportType == ReportType.Debug) type = "debug"; else type = "unknown"; StringBuffer sb = new StringBuffer(); sb.append('<'); sb.append(type); sb.append('>'); sb.append('\n'); sb.append(message.toXML(getBundle(), isHidingLocation(), isHidingPath(), showSource)); sb.append('<'); sb.append('/'); sb.append(type); sb.append('>'); sb.append('\n'); out(sb.toString()); }
public Message message(String key, String format, Object... arguments) { return new Message(key, format, arguments); }
public String toText() { return toText(null, false, false); } public String toText(ResourceBundle bundle) {
@Override public String toText(ResourceBundle bundle, boolean hideLocation, boolean hidePath) { String text = super.toText(bundle, false, false); if (uri != null) { StringBuffer sb = new StringBuffer();
protected void out(ReportType type, Message message) { out(type, message.toText(bundle, isHidingLocation(), isHidingPath())); }
sb.append(t); } else { throw new IllegalStateException(getReporter().message("x.021", "unexpected text field parse state: part {0}", part).toText());
sb.append(t); else throw new IllegalStateException(getReporter().message("x.021", "unexpected text field parse state: part {0}", p).toText());