@Test public void validateToString() { EntityReference reference1 = new EntityReference("page", EntityType.DOCUMENT, new EntityReference("space", EntityType.SPACE, new EntityReference("wiki", EntityType.WIKI))); assertEquals("Document wiki:space.page", reference1.toString()); EntityReference reference2 = new EntityReference("page", EntityType.DOCUMENT); assertEquals("Document page", reference2.toString()); EntityReference reference3 = new EntityReference("page", EntityType.DOCUMENT, new EntityReference("space", EntityType.SPACE)); assertEquals("Document space.page", reference3.toString()); Map<String, Serializable> map = new HashMap<>(); map.put("key1", "value1"); EntityReference reference4 = new EntityReference("page", EntityType.DOCUMENT, new EntityReference("space", EntityType.SPACE), map); assertEquals("Document space.page", reference4.toString()); EntityReference reference5 = new EntityReference("attachment", EntityType.ATTACHMENT, reference1); assertEquals("Attachment wiki:space.page@attachment", reference5.toString()); }
@Override public String toString() { StringBuilder sb = new StringBuilder(64); sb.append(StringUtils.capitalize(getType().getLowerCase())); sb.append(' '); sb.append(TOSTRING_SERIALIZER.serialize(this)); return sb.toString(); }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { @Override public String toString() { StringBuilder sb = new StringBuilder(64); sb.append(StringUtils.capitalize(getType().getLowerCase())); sb.append(' '); sb.append(TOSTRING_SERIALIZER.serialize(this)); return sb.toString(); } }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { @Override public String toString() { StringBuilder sb = new StringBuilder(64); sb.append(StringUtils.capitalize(getType().getLowerCase())); sb.append(' '); sb.append(TOSTRING_SERIALIZER.serialize(this)); return sb.toString(); } EntityReference(EntityReference reference);  EntityReference(EntityReference reference, EntityReference parent); protected  EntityReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  EntityReference(String name, EntityType type);  EntityReference(String name, EntityType type, EntityReference parent); @Unstable  EntityReference(String name, EntityType type, Map<String, Serializable> parameters);  EntityReference(String name, EntityType type, EntityReference parent, Map<String, Serializable> parameters); @Unstable  EntityReference(EntityReference reference, Map<String, Serializable> parameters); }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { @Override public String toString() { StringBuilder sb = new StringBuilder(64); sb.append(StringUtils.capitalize(getType().getLowerCase())); sb.append(' '); sb.append(TOSTRING_SERIALIZER.serialize(this)); return sb.toString(); } EntityReference(EntityReference reference);  EntityReference(EntityReference reference, EntityReference parent); protected  EntityReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  EntityReference(String name, EntityType type);  EntityReference(String name, EntityType type, EntityReference parent); @Unstable  EntityReference(String name, EntityType type, Map<String, Serializable> parameters);  EntityReference(String name, EntityType type, EntityReference parent, Map<String, Serializable> parameters); @Unstable  EntityReference(EntityReference reference, Map<String, Serializable> parameters); final String getName(); final EntityReference getParent(); final EntityType getType(); final Map<String, Serializable> getParameters(); @Transient EntityReference getRoot(); @Transient List<EntityReference> getReversedReferenceChain(); int size(); EntityReference extractReference(EntityType type); EntityReference extractFirstReference(EntityType type); EntityReference replaceParent(EntityReference oldParent, EntityReference newParent); EntityReference replaceParent(EntityReference newParent); EntityReference appendParent(EntityReference newParent); EntityReference removeParent(EntityReference oldParent); boolean hasParent(EntityReference expectedParent); @Override String toString(); @Override boolean equals(Object obj); boolean equals(EntityReference otherReference, EntityType to); boolean equals(EntityReference otherReference, EntityType from, EntityType to); boolean equalsNonRecursive(EntityReference otherReference); @Override int hashCode(); @Override int compareTo(EntityReference reference); }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { @Override public String toString() { StringBuilder sb = new StringBuilder(64); sb.append(StringUtils.capitalize(getType().getLowerCase())); sb.append(' '); sb.append(TOSTRING_SERIALIZER.serialize(this)); return sb.toString(); } EntityReference(EntityReference reference);  EntityReference(EntityReference reference, EntityReference parent); protected  EntityReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  EntityReference(String name, EntityType type);  EntityReference(String name, EntityType type, EntityReference parent); @Unstable  EntityReference(String name, EntityType type, Map<String, Serializable> parameters);  EntityReference(String name, EntityType type, EntityReference parent, Map<String, Serializable> parameters); @Unstable  EntityReference(EntityReference reference, Map<String, Serializable> parameters); final String getName(); final EntityReference getParent(); final EntityType getType(); final Map<String, Serializable> getParameters(); @Transient EntityReference getRoot(); @Transient List<EntityReference> getReversedReferenceChain(); int size(); EntityReference extractReference(EntityType type); EntityReference extractFirstReference(EntityType type); EntityReference replaceParent(EntityReference oldParent, EntityReference newParent); EntityReference replaceParent(EntityReference newParent); EntityReference appendParent(EntityReference newParent); EntityReference removeParent(EntityReference oldParent); boolean hasParent(EntityReference expectedParent); @Override String toString(); @Override boolean equals(Object obj); boolean equals(EntityReference otherReference, EntityType to); boolean equals(EntityReference otherReference, EntityType from, EntityType to); boolean equalsNonRecursive(EntityReference otherReference); @Override int hashCode(); @Override int compareTo(EntityReference reference);  }