Skip to content
Snippets Groups Projects
Commit 0f77dade authored by Thorsten Vitt's avatar Thorsten Vitt
Browse files

toString methods for testing & debugging

parent ebd3370c
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import java.util.List; import java.util.List;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
public class Aggregation extends AggregationEntry { public class Aggregation extends AggregationEntry {
...@@ -18,6 +19,11 @@ public Aggregation(final ObjectType metadata, final Aggregation parent) { ...@@ -18,6 +19,11 @@ public Aggregation(final ObjectType metadata, final Aggregation parent) {
super(metadata, parent); super(metadata, parent);
} }
@Override
public String toString() {
return super.toString() + ": [" + Joiner.on(", ").join(children) + "]";
}
protected Aggregation add(final AggregationEntry child) { protected Aggregation add(final AggregationEntry child) {
children.add(child); children.add(child);
return this; return this;
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
import info.textgrid.namespaces.metadata.core._2010.ObjectType; import info.textgrid.namespaces.metadata.core._2010.ObjectType;
import java.text.MessageFormat;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
public class AggregationEntry { public class AggregationEntry {
...@@ -27,4 +29,16 @@ public ObjectType getMetadata() { ...@@ -27,4 +29,16 @@ public ObjectType getMetadata() {
return metadata; return metadata;
} }
@Override
public String toString() {
try {
return MessageFormat.format("{0} ({1}, {2})", metadata.getGeneric()
.getGenerated().getTextgridUri().getValue(), metadata
.getGeneric().getProvided().getTitle().get(0), metadata
.getGeneric().getProvided().getFormat());
} catch (final NullPointerException e) {
return ("<AggregationEntry w/o complete metadata>");
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment