1. Christophe Furmaniak
  2. acacia-tag-resolver

Commits

Christophe Furmaniak  committed 4f2a882

new AbstractOperation to provide a default toString for all operations

  • Participants
  • Parent commits 53a413e
  • Branches default

Comments (0)

Files changed (1)

File src/main/java/net/awl/acacia/tagresolver/operations/AbstractOperation.java

View file
  • Ignore whitespace
+package net.awl.acacia.tagresolver.operations;
+
+import com.google.gson.Gson;
+import net.awl.acacia.tagresolver.Operation;
+
+/**
+ * User: cfurmaniak
+ * Date: 17/09/12
+ * Time: 20:52
+ */
+public abstract class AbstractOperation implements Operation {
+    private transient String _toString = null;
+
+    @Override
+    public String toString() {
+        if (_toString == null) {
+            _toString = new Gson().toJson(this);
+        }
+        return _toString;
+    }
+}