@Override public void loadFromXML(Reader in) { XMLConfiguration xml = ConfigurationUtil.newXMLConfiguration(in); setRegex(xml.getString("")); super.loadFromXML(xml); setCaseSensitive(xml.getBoolean("[@caseSensitive]", false)); }
@Override public void saveToXML(Writer out) throws IOException { XMLOutputFactory factory = XMLOutputFactory.newInstance(); try { XMLStreamWriter writer = factory.createXMLStreamWriter(out); writer.writeStartElement("filter"); writer.writeAttribute("class", getClass().getCanonicalName()); super.saveToXML(writer); writer.writeAttribute("caseSensitive", Boolean.toString(caseSensitive)); writer.writeCharacters(regex == null ? "" : regex); writer.writeEndElement(); writer.flush(); writer.close(); } catch (XMLStreamException e) { throw new IOException("Cannot save as XML.", e); } }