@Test public void testResolveAndSerializePropertyReference() { EntityReference reference = resolver.resolve("wiki:space.page^xwiki.class[0].prop", EntityType.OBJECT_PROPERTY); Assert.assertEquals("wiki:space.page^xwiki.class[0].prop", serializer.serialize(reference)); reference = resolver.resolve("", EntityType.OBJECT_PROPERTY); Assert.assertEquals("xwiki:XWiki.WebHome^Object.Property", serializer.serialize(reference)); reference = resolver.resolve("space^page@attachment", EntityType.OBJECT_PROPERTY); Assert .assertEquals("xwiki:XWiki.WebHome^Object.space^page@attachment", serializer.serialize(reference)); reference = resolver.resolve("wiki:space^object", EntityType.OBJECT_PROPERTY); Assert.assertEquals("xwiki:XWiki.WebHome^Object.wiki:space^object", serializer.serialize(reference)); reference = resolver.resolve("wiki:space.page^xwiki.class[0].prop\\.erty", EntityType.OBJECT_PROPERTY); Assert.assertEquals("wiki:space.page^xwiki.class[0].prop\\.erty", serializer.serialize(reference)); reference = resolver.resolve(":\\.^@", EntityType.OBJECT_PROPERTY); Assert.assertEquals("xwiki:XWiki.WebHome^Object.:\\.^@", serializer.serialize(reference)); }
public String serialize(EntityReference reference) { if (reference == null) { return null; } EntityReference currentReference = reference.getRoot(); StringBuilder representation = new StringBuilder(); while (currentReference != null && currentReference != reference.getChild()) { serializeEntityReference(currentReference, representation, currentReference == reference); currentReference = currentReference.getChild(); } return representation.toString(); }
DefaultStringEntityReferenceSerializer implements EntityReferenceSerializer<String> { public String serialize(EntityReference reference) { if (reference == null) { return null; } EntityReference currentReference = reference.getRoot(); StringBuilder representation = new StringBuilder(); while (currentReference != null && currentReference != reference.getChild()) { serializeEntityReference(currentReference, representation, currentReference == reference); currentReference = currentReference.getChild(); } return representation.toString(); } }
DefaultStringEntityReferenceSerializer implements EntityReferenceSerializer<String> { public String serialize(EntityReference reference) { if (reference == null) { return null; } EntityReference currentReference = reference.getRoot(); StringBuilder representation = new StringBuilder(); while (currentReference != null && currentReference != reference.getChild()) { serializeEntityReference(currentReference, representation, currentReference == reference); currentReference = currentReference.getChild(); } return representation.toString(); }  }
DefaultStringEntityReferenceSerializer implements EntityReferenceSerializer<String> { public String serialize(EntityReference reference) { if (reference == null) { return null; } EntityReference currentReference = reference.getRoot(); StringBuilder representation = new StringBuilder(); while (currentReference != null && currentReference != reference.getChild()) { serializeEntityReference(currentReference, representation, currentReference == reference); currentReference = currentReference.getChild(); } return representation.toString(); }  String serialize(EntityReference reference); }
DefaultStringEntityReferenceSerializer implements EntityReferenceSerializer<String> { public String serialize(EntityReference reference) { if (reference == null) { return null; } EntityReference currentReference = reference.getRoot(); StringBuilder representation = new StringBuilder(); while (currentReference != null && currentReference != reference.getChild()) { serializeEntityReference(currentReference, representation, currentReference == reference); currentReference = currentReference.getChild(); } return representation.toString(); }  String serialize(EntityReference reference);  }