Give SoyTemplate a useful toString() method.
GITHUB_BREAKING_CHANGES=none
@@ -23,6 +23,7 @@ import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static com.google.common.collect.Streams.stream;
import com.google.common.base.Joiner;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -97,6 +98,14 @@ public abstract class BaseSoyTemplateImpl implements SoyTemplate {
return Objects.hashCode(getClass(), data);
}
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("name", getTemplateName())
+ .add("data", getParamsAsMap())
+ .toString();
+ }
+
/**
* The abstract superclass for generated per-template parameter builders. Each public template
* will have a corresponding generated subtype of this class. Do not extend outside of Soy
