registry.build(Entry.KEY, RSS).setName(ITEM);
registry.build(Entry.KEY, Entry.ETAG, RSS)
.setVisible(false);
XmlWireFormatProperties properties = new XmlWireFormatProperties();
properties.setElementGenerator(new XmlGenerator.XmlElementGenerator() {
@Override
protected List<Attribute> getAttributes(Element e,
ElementMetadata<?, ?> metadata) {
List<Attribute> attrs = super.getAttributes(e, metadata);
if (attrs == null) {
attrs = Lists.newArrayListWithExpectedSize(1);
}
attrs.add(new Attribute("isPermaLink", "false"));
return attrs;
}
});
registry.build(Entry.KEY, Entry.ID, RSS)
.setName(GUID)
.setProperties(properties);
registry.build(Entry.KEY, Entry.TITLE, RSS)
.setName(TITLE);
registry.build(Entry.KEY, Entry.PUBLISHED, RSS)
.setName(PUB_DATE)
.setVirtualValue(new VirtualValue() {
public Object generate(Element element,
ElementMetadata<?, ?> metadata) {
DateTime date = element.getTextValue(Entry.PUBLISHED);
return date == null ? "" : date.toStringRfc822();
}
public void parse(Element element, ElementMetadata<?, ?> metadata,
Object value) throws ParseException {
DateTime parsed = DateTime.parseRfc822(value.toString());
element.setTextValue(parsed);
}
});
XmlWireFormatProperties personProperties = new XmlWireFormatProperties();
personProperties.setElementGenerator(
new XmlGenerator.XmlElementGenerator() {
@Override
public boolean startElement(XmlWriter xw, Element parent, Element e,
ElementMetadata<?, ?> metadata) throws IOException {
if (!(e instanceof Person)) {