@Override
public void marshal(Object source, HierarchicalStreamWriter writer,
MarshallingContext context) {
GraphEdge edge = (GraphEdge) source;
Relation relation = edge.getRelation();
writer.startNode(RELATION_TAG);
Class<?> actualType = relation.getClass();
Class<?> defaultType = mapper.defaultImplementationOf(BasicEdge.class);
if (!actualType.equals(defaultType)) {
writer.addAttribute(
mapper.aliasForAttribute("class"),
mapper.serializedClass(actualType));