@Test public void testToString() { ResourceReference reference = new ResourceReference("reference", ResourceType.DOCUMENT); assertEquals("Typed = [true] Type = [doc] Reference = [reference]", reference.toString()); reference.addBaseReference("baseref1"); reference.addBaseReference("baseref2"); assertEquals("Typed = [true] Type = [doc] Reference = [reference] " + "Base References = [[baseref1], [baseref2]]", reference.toString()); reference.setParameter("name1", "value1"); reference.setParameter("name2", "value2"); assertEquals("Typed = [true] Type = [doc] Reference = [reference] " + "Base References = [[baseref1], [baseref2]] " + "Parameters = [[name1] = [value1], [name2] = [value2]]", reference.toString()); }
@Override public String toString() { XWikiToStringStyle style = new XWikiToStringStyle(); style.setSeparator(""); ToStringBuilder builder = new ToStringBuilder(this, style); builder = builder.append("Typed", isTyped()).append("Type", getType()); if (getReference() != null) { builder = builder.append("Reference", getReference()); } if (!getBaseReferences().isEmpty()) { builder = builder.append("Base References", getBaseReferences()); } Map<String, String> params = getParameters(); if (!params.isEmpty()) { builder = builder.append("Parameters", params); } return builder.toString(); }
ResourceReference implements Cloneable { @Override public String toString() { XWikiToStringStyle style = new XWikiToStringStyle(); style.setSeparator(""); ToStringBuilder builder = new ToStringBuilder(this, style); builder = builder.append("Typed", isTyped()).append("Type", getType()); if (getReference() != null) { builder = builder.append("Reference", getReference()); } if (!getBaseReferences().isEmpty()) { builder = builder.append("Base References", getBaseReferences()); } Map<String, String> params = getParameters(); if (!params.isEmpty()) { builder = builder.append("Parameters", params); } return builder.toString(); } }
ResourceReference implements Cloneable { @Override public String toString() { XWikiToStringStyle style = new XWikiToStringStyle(); style.setSeparator(""); ToStringBuilder builder = new ToStringBuilder(this, style); builder = builder.append("Typed", isTyped()).append("Type", getType()); if (getReference() != null) { builder = builder.append("Reference", getReference()); } if (!getBaseReferences().isEmpty()) { builder = builder.append("Base References", getBaseReferences()); } Map<String, String> params = getParameters(); if (!params.isEmpty()) { builder = builder.append("Parameters", params); } return builder.toString(); } ResourceReference(String reference, ResourceType type); }
ResourceReference implements Cloneable { @Override public String toString() { XWikiToStringStyle style = new XWikiToStringStyle(); style.setSeparator(""); ToStringBuilder builder = new ToStringBuilder(this, style); builder = builder.append("Typed", isTyped()).append("Type", getType()); if (getReference() != null) { builder = builder.append("Reference", getReference()); } if (!getBaseReferences().isEmpty()) { builder = builder.append("Base References", getBaseReferences()); } Map<String, String> params = getParameters(); if (!params.isEmpty()) { builder = builder.append("Parameters", params); } return builder.toString(); } ResourceReference(String reference, ResourceType type); void setTyped(boolean typed); boolean isTyped(); void setReference(String reference); String getReference(); void addBaseReference(String baseReference); void addBaseReferences(List<String> baseReferences); List<String> getBaseReferences(); ResourceType getType(); void setType(ResourceType type); void setParameter(String name, String value); void setParameters(Map<String, String> parameters); void removeParameter(String name); String getParameter(String name); Map<String, String> getParameters(); @Override String toString(); @Override ResourceReference clone(); @Override int hashCode(); @Override boolean equals(Object object); }
ResourceReference implements Cloneable { @Override public String toString() { XWikiToStringStyle style = new XWikiToStringStyle(); style.setSeparator(""); ToStringBuilder builder = new ToStringBuilder(this, style); builder = builder.append("Typed", isTyped()).append("Type", getType()); if (getReference() != null) { builder = builder.append("Reference", getReference()); } if (!getBaseReferences().isEmpty()) { builder = builder.append("Base References", getBaseReferences()); } Map<String, String> params = getParameters(); if (!params.isEmpty()) { builder = builder.append("Parameters", params); } return builder.toString(); } ResourceReference(String reference, ResourceType type); void setTyped(boolean typed); boolean isTyped(); void setReference(String reference); String getReference(); void addBaseReference(String baseReference); void addBaseReferences(List<String> baseReferences); List<String> getBaseReferences(); ResourceType getType(); void setType(ResourceType type); void setParameter(String name, String value); void setParameters(Map<String, String> parameters); void removeParameter(String name); String getParameter(String name); Map<String, String> getParameters(); @Override String toString(); @Override ResourceReference clone(); @Override int hashCode(); @Override boolean equals(Object object);  }