From b76cd53fbb89d4f8ba17c27160825132f9806740 Mon Sep 17 00:00:00 2001 From: Neil C Smith Date: Wed, 22 May 2024 10:02:42 +0100 Subject: [PATCH] Update Serializable protocol to not use a property prefix. --- .../core/protocols/SerializableProtocol.java | 11 +++++------ .../main/java/org/praxislive/base/MapTreeWriter.java | 5 ++--- .../java/org/praxislive/base/MapTreeWriterTest.java | 10 +++++----- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/praxiscore-api/src/main/java/org/praxislive/core/protocols/SerializableProtocol.java b/praxiscore-api/src/main/java/org/praxislive/core/protocols/SerializableProtocol.java index 8ce241da..7b2a1172 100644 --- a/praxiscore-api/src/main/java/org/praxislive/core/protocols/SerializableProtocol.java +++ b/praxiscore-api/src/main/java/org/praxislive/core/protocols/SerializableProtocol.java @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 2023 Neil C Smith. + * Copyright 2024 Neil C Smith. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 3 only, as @@ -35,19 +35,18 @@ * usually be implemented by a root container. *

* The standard format is a hierarchical map. Annotation keys, including type, - * info and connections, are prefixed by %. Property keys are - * prefixed by .. Child keys are prefixed by @ and the - * values are maps. + * info and connections, are prefixed by %. Child keys are prefixed + * by @ and the values are maps. Property keys are not prefixed. *

  * {@code
  * %type core:container
  * %info ...
  * %custom-annotation foo
- * .property1 true
+ * property1 true
  * @child1 {
  *   %type core:custom
  *   %info ...
- *   .property1 42
+ *   property1 42
  * }
  * @child2 {
  *   %type core:custom
diff --git a/praxiscore-base/src/main/java/org/praxislive/base/MapTreeWriter.java b/praxiscore-base/src/main/java/org/praxislive/base/MapTreeWriter.java
index d7a44b4e..08b15bf7 100644
--- a/praxiscore-base/src/main/java/org/praxislive/base/MapTreeWriter.java
+++ b/praxiscore-base/src/main/java/org/praxislive/base/MapTreeWriter.java
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  * 
- * Copyright 2023 Neil C Smith.
+ * Copyright 2024 Neil C Smith.
  * 
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 3 only, as
@@ -44,7 +44,6 @@ public final class MapTreeWriter implements TreeWriter {
 
     private static final String ANNOTATION_PREFIX = "%";
     private static final String CHILD_PREFIX = "@";
-    private static final String PROPERTY_PREFIX = ".";
 
     private static final String TYPE_KEY = ANNOTATION_PREFIX + "type";
     private static final String INFO_KEY = ANNOTATION_PREFIX + "info";
@@ -97,7 +96,7 @@ public MapTreeWriter writeInfo(ComponentInfo info) {
 
     @Override
     public MapTreeWriter writeProperty(String id, Value value) {
-        map.put(PROPERTY_PREFIX + id, value);
+        map.put(id, value);
         return this;
     }
 
diff --git a/praxiscore-base/src/test/java/org/praxislive/base/MapTreeWriterTest.java b/praxiscore-base/src/test/java/org/praxislive/base/MapTreeWriterTest.java
index e0d2f374..d578648d 100644
--- a/praxiscore-base/src/test/java/org/praxislive/base/MapTreeWriterTest.java
+++ b/praxiscore-base/src/test/java/org/praxislive/base/MapTreeWriterTest.java
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  * 
- * Copyright 2023 Neil C Smith.
+ * Copyright 2024 Neil C Smith.
  * 
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 3 only, as
@@ -79,18 +79,18 @@ private PMap buildComparison() {
         builder.put("%type", ComponentType.of("core:container"));
         builder.put("%info", ContainerProtocol.API_INFO);
         builder.put("%custom", PString.of("FOO"));
-        builder.put(".p1", 1);
-        builder.put(".p2", true);
+        builder.put("p1", 1);
+        builder.put("p2", true);
         builder.put("@child1", PMap.builder()
                 .put("%type", ComponentType.of("core:type1"))
                 .put("%info", ComponentProtocol.API_INFO)
-                .put(".p1", "value")
+                .put("p1", "value")
                 .build()
         );
         builder.put("@child2", PMap.builder()
                 .put("%type", ComponentType.of("core:type2"))
                 .put("%info", ComponentProtocol.API_INFO)
-                .put(".p1", 42)
+                .put("p1", 42)
                 .build()
         );
         builder.put("%connections", PArray.of(