diff artifact-database/src/main/java/de/intevation/artifactdatabase/data/DefaultStateData.java @ 322:93a774fe2bb4

Added deepCopy() method to facets and state data. artifacts/trunk@2530 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 23 Aug 2011 10:54:38 +0000
parents 62dd8438885f
children
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/data/DefaultStateData.java	Mon Aug 22 10:05:39 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/data/DefaultStateData.java	Tue Aug 23 10:54:38 2011 +0000
@@ -25,6 +25,8 @@
     /** The value. */
     protected Object value;
 
+    public DefaultStateData() {
+    }
 
     /**
      * The default constructor. It creates empty StateData objects with no
@@ -40,6 +42,13 @@
         this.type        = type;
     }
 
+    public void set(StateData other) {
+        name        = other.getName();
+        description = other.getDescription();
+        type        = other.getType();
+        value       = other.getValue();
+    }
+
 
     /**
      * A constructor that takes the name of the data, its value and the
@@ -111,5 +120,12 @@
     public void setValue(Object value) {
         this.value = value;
     }
+
+    @Override
+    public StateData deepCopy() {
+        DefaultStateData copy = new DefaultStateData();
+        copy.set(this);
+        return copy;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org