@Test public void testSerializeWhenNoContext() throws Exception { DocumentReference reference = new DocumentReference("wiki", "space", "page"); Assert.assertEquals("wiki:space.page", this.mocker.getComponentUnderTest().serialize(reference)); }
@Override public String serialize(EntityReference reference, Object... parameters) { if (reference == null) { return null; } StringBuilder representation = new StringBuilder(); List<EntityReference> references = reference.getReversedReferenceChain(); for (int i = 0; i < references.size();) { EntityReference currentReference = references.get(i); EntityType currentType = currentReference.getType(); while (++i < references.size() && references.get(i).getType() == currentType) { currentReference = references.get(i); } if (shouldSerialize(currentReference, representation, currentReference == reference, parameters)) { serializeEntityReferenceType(currentReference, representation, currentReference == reference); } } return representation.toString(); }
CompactStringEntityReferenceSerializer extends DefaultStringEntityReferenceSerializer { @Override public String serialize(EntityReference reference, Object... parameters) { if (reference == null) { return null; } StringBuilder representation = new StringBuilder(); List<EntityReference> references = reference.getReversedReferenceChain(); for (int i = 0; i < references.size();) { EntityReference currentReference = references.get(i); EntityType currentType = currentReference.getType(); while (++i < references.size() && references.get(i).getType() == currentType) { currentReference = references.get(i); } if (shouldSerialize(currentReference, representation, currentReference == reference, parameters)) { serializeEntityReferenceType(currentReference, representation, currentReference == reference); } } return representation.toString(); } }
CompactStringEntityReferenceSerializer extends DefaultStringEntityReferenceSerializer { @Override public String serialize(EntityReference reference, Object... parameters) { if (reference == null) { return null; } StringBuilder representation = new StringBuilder(); List<EntityReference> references = reference.getReversedReferenceChain(); for (int i = 0; i < references.size();) { EntityReference currentReference = references.get(i); EntityType currentType = currentReference.getType(); while (++i < references.size() && references.get(i).getType() == currentType) { currentReference = references.get(i); } if (shouldSerialize(currentReference, representation, currentReference == reference, parameters)) { serializeEntityReferenceType(currentReference, representation, currentReference == reference); } } return representation.toString(); }  }
CompactStringEntityReferenceSerializer extends DefaultStringEntityReferenceSerializer { @Override public String serialize(EntityReference reference, Object... parameters) { if (reference == null) { return null; } StringBuilder representation = new StringBuilder(); List<EntityReference> references = reference.getReversedReferenceChain(); for (int i = 0; i < references.size();) { EntityReference currentReference = references.get(i); EntityType currentType = currentReference.getType(); while (++i < references.size() && references.get(i).getType() == currentType) { currentReference = references.get(i); } if (shouldSerialize(currentReference, representation, currentReference == reference, parameters)) { serializeEntityReferenceType(currentReference, representation, currentReference == reference); } } return representation.toString(); }  @Override String serialize(EntityReference reference, Object... parameters); }
CompactStringEntityReferenceSerializer extends DefaultStringEntityReferenceSerializer { @Override public String serialize(EntityReference reference, Object... parameters) { if (reference == null) { return null; } StringBuilder representation = new StringBuilder(); List<EntityReference> references = reference.getReversedReferenceChain(); for (int i = 0; i < references.size();) { EntityReference currentReference = references.get(i); EntityType currentType = currentReference.getType(); while (++i < references.size() && references.get(i).getType() == currentType) { currentReference = references.get(i); } if (shouldSerialize(currentReference, representation, currentReference == reference, parameters)) { serializeEntityReferenceType(currentReference, representation, currentReference == reference); } } return representation.toString(); }  @Override String serialize(EntityReference reference, Object... parameters);  }