[gxml/serialization] API break at interfaces for SerializableTreeMap/DualKeyMap



commit b6cf213c4cd7d9de188fc069f7152ce4cf85819c
Author: Daniel Espinosa <esodan gmail com>
Date:   Thu Nov 28 13:39:01 2013 -0600

    API break at interfaces for SerializableTreeMap/DualKeyMap
    
    * Renamed SerializableMapId to SerializableMapKey
    * Renamed SerializableMapDualId to SerializableMapDualKey
    * Renamed functions to get Keys for SerializableMapKey and
      SerializableMapDualKey to avoid conflics with implementator's
      use of id() and primary/secundary_id () functions/properties.

 gxml/Makefile.am                                   |    4 ++--
 gxml/SerializableGeeDualKeyMap.vala                |    6 +++---
 gxml/SerializableGeeTreeMap.vala                   |    4 ++--
 ...eMapDualId.vala => SerializableMapDualKey.vala} |    6 +++---
 ...ializableMapId.vala => SerializableMapKey.vala} |    4 ++--
 test/SerializableGeeCollectionsTest.vala           |   20 ++++++++++----------
 test/SerializableGeeDualKeyMapTest.vala            |    6 +++---
 test/SerializableGeeTreeMapTest.vala               |    4 ++--
 8 files changed, 27 insertions(+), 27 deletions(-)
---
diff --git a/gxml/Makefile.am b/gxml/Makefile.am
index 25c2e20..1508209 100644
--- a/gxml/Makefile.am
+++ b/gxml/Makefile.am
@@ -66,9 +66,9 @@ libgxml_la_SOURCES = \
        SerializableJson.vala \
        Serialization.vala \
        SerializableGeeTreeMap.vala \
-       SerializableMapId.vala \
+       SerializableMapKey.vala \
        SerializableGeeDualKeyMap.vala \
-       SerializableMapDualId.vala \
+       SerializableMapDualKey.vala \
        SerializableGeeArrayList.vala \
        $(NULL)
 
diff --git a/gxml/SerializableGeeDualKeyMap.vala b/gxml/SerializableGeeDualKeyMap.vala
index bd56620..c1c1536 100644
--- a/gxml/SerializableGeeDualKeyMap.vala
+++ b/gxml/SerializableGeeDualKeyMap.vala
@@ -198,17 +198,17 @@ public class GXml.SerializableDualKeyMap<P,S,V> : Object, Serializable
                     throws GLib.Error
   {
     if (!(value_type.is_a (typeof (GXml.Serializable)) &&
-        value_type.is_a (typeof (SerializableMapDualId)))) {
+        value_type.is_a (typeof (SerializableMapDualKey)))) {
       throw new SerializableError.UNSUPPORTED_TYPE ("%s: Value type '%s' is unsupported", 
                                                     this.get_type ().name (), value_type.name ());
     }
     if (node is Element) {
       foreach (GXml.Node n in node.child_nodes) {
         if (n is Element) {
-          var obj = (SerializableMapDualId<P,S>) Object.new (value_type);
+          var obj = (SerializableMapDualKey<P,S>) Object.new (value_type);
           if (n.node_name == ((Serializable) obj).node_name ()) {
             ((Serializable) obj).deserialize (n);
-            @set (obj.primary_id (), obj.secondary_id (), obj);
+            @set (obj.get_map_primary_key (), obj.get_map_secondary_key (), obj);
           }
         }
       }
diff --git a/gxml/SerializableGeeTreeMap.vala b/gxml/SerializableGeeTreeMap.vala
index 5cd85c8..13097a2 100644
--- a/gxml/SerializableGeeTreeMap.vala
+++ b/gxml/SerializableGeeTreeMap.vala
@@ -113,7 +113,7 @@ public class GXml.SerializableTreeMap<K,V> : Gee.TreeMap<K,V>, Serializable
                     throws GLib.Error
   {
     if (!(value_type.is_a (typeof (GXml.Serializable)) &&
-        value_type.is_a (typeof (SerializableMapId)))) {
+        value_type.is_a (typeof (SerializableMapKey)))) {
       throw new SerializableError.UNSUPPORTED_TYPE ("%s: Value type '%s' is unsupported", 
                                                     this.get_type ().name (), value_type.name ());
     }
@@ -126,7 +126,7 @@ public class GXml.SerializableTreeMap<K,V> : Gee.TreeMap<K,V>, Serializable
           var obj = Object.new (value_type);
           if (n.node_name == ((Serializable) obj).node_name ()) {
             ((Serializable) obj).deserialize (n);
-            @set (((SerializableMapId<K>) obj).id (), obj);
+            @set (((SerializableMapKey<K>) obj).get_map_key (), obj);
           }
         }
       }
diff --git a/gxml/SerializableMapDualId.vala b/gxml/SerializableMapDualKey.vala
similarity index 86%
rename from gxml/SerializableMapDualId.vala
rename to gxml/SerializableMapDualKey.vala
index 2a80004..e260cd8 100644
--- a/gxml/SerializableMapDualId.vala
+++ b/gxml/SerializableMapDualKey.vala
@@ -20,8 +20,8 @@
  *      Daniel Espinosa <esodan gmail com>
  */
 using GXml;
-public interface SerializableMapDualId<P,S> : Object
+public interface SerializableMapDualKey<P,S> : Object
 {
-  public abstract P primary_id  ();
-  public abstract S secondary_id ();
+  public abstract P get_map_primary_key  ();
+  public abstract S get_map_secondary_key ();
 }
diff --git a/gxml/SerializableMapId.vala b/gxml/SerializableMapKey.vala
similarity index 91%
rename from gxml/SerializableMapId.vala
rename to gxml/SerializableMapKey.vala
index 897a3d7..944b1b0 100644
--- a/gxml/SerializableMapId.vala
+++ b/gxml/SerializableMapKey.vala
@@ -21,7 +21,7 @@
  */
 using GXml;
 
-public interface GXml.SerializableMapId<K> : Object
+public interface GXml.SerializableMapKey<K> : Object
 {
-  public abstract K id ();
+  public abstract K get_map_key ();
 }
diff --git a/test/SerializableGeeCollectionsTest.vala b/test/SerializableGeeCollectionsTest.vala
index 1e21b9e..ecf2fac 100644
--- a/test/SerializableGeeCollectionsTest.vala
+++ b/test/SerializableGeeCollectionsTest.vala
@@ -5,9 +5,9 @@ using Gee;
 
 class SerializableGeeCollectionsTest : GXmlTest
 {
-  class Planet : SerializableObjectModel, SerializableMapId<string>
+  class Planet : SerializableObjectModel, SerializableMapKey<string>
   {
-    public string id () { return name; }
+    public string get_map_key () { return name; }
     public string name { get; set; }
     public Planet.named (string name) { this.name = name; }
     public override string node_name () { return "planet"; }
@@ -15,9 +15,9 @@ class SerializableGeeCollectionsTest : GXmlTest
 
     public class Collection : SerializableTreeMap<string,Planet> {}
   }
-  class Space : SerializableObjectModel, SerializableMapId<string>
+  class Space : SerializableObjectModel, SerializableMapKey<string>
   {
-    public string id () { return name; }
+    public string get_map_key () { return name; }
     public string name { get; set; }
     public Planet.Collection planets { get; set; }
     
@@ -40,7 +40,7 @@ class SerializableGeeCollectionsTest : GXmlTest
 
     public class Collection : SerializableTreeMap<string,Space> {}
   }
-  class Refaction : SerializableObjectModel, SerializableMapDualId<string,string>
+  class Refaction : SerializableObjectModel, SerializableMapDualKey<string,string>
   {
     public string model { get; set; }
     public string manufacturer { get; set; }
@@ -52,8 +52,8 @@ class SerializableGeeCollectionsTest : GXmlTest
       this.model = model;
     }
     
-    public string primary_id () { return manufacturer; }
-    public string secondary_id () { return model; }
+    public string get_map_primary_key () { return manufacturer; }
+    public string get_map_secondary_key () { return model; }
     
     public override string node_name () { return "refaction"; }
     public override string to_string () { return model; }
@@ -72,7 +72,7 @@ class SerializableGeeCollectionsTest : GXmlTest
 
     public class Collection : SerializableDualKeyMap<string,string,Refaction> {}
   }
-  class SpaceShip : SerializableObjectModel, SerializableMapDualId<string,string>
+  class SpaceShip : SerializableObjectModel, SerializableMapDualKey<string,string>
   {
     public string model { get; set; }
     public string manufacturer { get; set; }
@@ -84,8 +84,8 @@ class SerializableGeeCollectionsTest : GXmlTest
       this.model = model;
     }
     
-    public string primary_id () { return manufacturer; }
-    public string secondary_id () { return model; }
+    public string get_map_primary_key () { return manufacturer; }
+    public string get_map_secondary_key () { return model; }
     
     public override string node_name () { return "ship"; }
     public override string to_string () { return model; }
diff --git a/test/SerializableGeeDualKeyMapTest.vala b/test/SerializableGeeDualKeyMapTest.vala
index cb9b71a..3e98515 100644
--- a/test/SerializableGeeDualKeyMapTest.vala
+++ b/test/SerializableGeeDualKeyMapTest.vala
@@ -1,10 +1,10 @@
 using GXml;
 using Gee;
 
-class Spaces : SerializableObjectModel, SerializableMapDualId<string,string>
+class Spaces : SerializableObjectModel, SerializableMapDualKey<string,string>
 {
-  public string primary_id  () { return owner; }
-  public string secondary_id () { return name; }
+  public string get_map_primary_key  () { return owner; }
+  public string get_map_secondary_key () { return name; }
   public string name { get; set; }
   public string owner { get; set; }
   public Spaces.full ( string owner, string name)
diff --git a/test/SerializableGeeTreeMapTest.vala b/test/SerializableGeeTreeMapTest.vala
index fed64cb..d57d324 100644
--- a/test/SerializableGeeTreeMapTest.vala
+++ b/test/SerializableGeeTreeMapTest.vala
@@ -3,9 +3,9 @@ using Gee;
 
 class SerializableGeeTreeMapTest : GXmlTest
 {
-  class Space : SerializableObjectModel, SerializableMapId<string>
+  class Space : SerializableObjectModel, SerializableMapKey<string>
   {
-    public string id () { return name; }
+    public string get_map_key () { return name; }
     public string name { get; set; }
     public Space.named (string name) { this.name = name; }
     public override string node_name () { return "space"; }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]