You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2018/08/16 10:02:53 UTC

[sling-whiteboard] branch master updated: Move things around for readability

This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new c1e9497  Move things around for readability
c1e9497 is described below

commit c1e94977910cab51eeca5596f0a5812bce1c001d
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Aug 16 12:02:44 2018 +0200

    Move things around for readability
---
 .../sling/resourceschemas/api/ResourceSchema.java  | 80 +++++++++++-----------
 .../resourceschemas/demo/schemas/DemoSchemas.java  | 11 +--
 2 files changed, 47 insertions(+), 44 deletions(-)

diff --git a/resource-schemas/core/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchema.java b/resource-schemas/core/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchema.java
index 5a81ee8..970fd90 100644
--- a/resource-schemas/core/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchema.java
+++ b/resource-schemas/core/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchema.java
@@ -30,6 +30,47 @@ public class ResourceSchema {
     
     private final Builder b;
     
+    /** Builder must be used to construct ResourceSchema objects */
+    private ResourceSchema(Builder b) {
+        this.b = b;
+    }
+    
+    /** @return the name of this schema */
+    public String getName() {
+        return b.name;
+    }
+    
+    /** @return a textual description of this schema */
+    public String getDescription() {
+        return b.description;
+    }
+    
+    /** @return an Iterator over resource types that
+     *  can be POSTed to this Resource.
+     */
+    public Collection<ResourceAction> getActions() {
+        return Collections.unmodifiableCollection(b.actions);
+    }
+    
+    /** @return an Iterator over the Resource Properties of this schema */
+    public Collection<ResourceProperty> getProperties() {
+        return Collections.unmodifiableCollection(b.properties);
+    }
+    
+    @Override
+    public String toString() {
+       final StringBuilder sb = new StringBuilder();
+       sb.append(getClass().getSimpleName()).append(":");
+       sb.append(b.name).append(":").append(b.description);
+       sb.append("\nproperties=").append(b.properties);
+       sb.append("\npactions=").append(b.actions);
+       return sb.toString();
+    }
+    
+    public static Builder BUILDER() {
+        return new Builder();
+    }
+    
     public static class Builder {
         
         String name;
@@ -62,43 +103,4 @@ public class ResourceSchema {
         }
     }
     
-    private ResourceSchema(Builder b) {
-        this.b = b;
-    }
-    
-    public static Builder BUILDER() {
-        return new Builder();
-    }
-    
-    @Override
-    public String toString() {
-       final StringBuilder sb = new StringBuilder();
-       sb.append(getClass().getSimpleName()).append(":");
-       sb.append(b.name).append(":").append(b.description);
-       sb.append("\nproperties=").append(b.properties);
-       sb.append("\npactions=").append(b.actions);
-       return sb.toString();
-    }
-    
-    /** @return the name of this schema */
-    public String getName() {
-        return b.name;
-    }
-    
-    /** @return a textual description of this schema */
-    public String getDescription() {
-        return b.description;
-    }
-    
-    /** @return an Iterator over resource types that
-     *  can be POSTed to this Resource.
-     */
-    public Collection<ResourceAction> getActions() {
-        return Collections.unmodifiableCollection(b.actions);
-    }
-    
-    /** @return an Iterator over the Resource Properties of this schema */
-    public Collection<ResourceProperty> getProperties() {
-        return Collections.unmodifiableCollection(b.properties);
-    }
 }
\ No newline at end of file
diff --git a/resource-schemas/demo/src/main/java/org/apache/sling/resourceschemas/demo/schemas/DemoSchemas.java b/resource-schemas/demo/src/main/java/org/apache/sling/resourceschemas/demo/schemas/DemoSchemas.java
index 764f8c5..0ae5314 100644
--- a/resource-schemas/demo/src/main/java/org/apache/sling/resourceschemas/demo/schemas/DemoSchemas.java
+++ b/resource-schemas/demo/src/main/java/org/apache/sling/resourceschemas/demo/schemas/DemoSchemas.java
@@ -29,11 +29,6 @@ import org.apache.sling.resourceschemas.api.*;
  */
 class DemoSchemas {
 
-    static String RT_ROOT = "srs/demo/root";
-    static String RT_BLOG_HOME = "srs/demo/blog/home";
-    static String RT_BLOG_FOLDER = "srs/demo/blog/folder";
-    static String RT_BLOG_POST = "srs/blog/post";
-    
     static Collection<ResourceSchema> getSchemas() {
         final List<ResourceSchema> list = new ArrayList<>();
         
@@ -71,4 +66,10 @@ class DemoSchemas {
         );
         return Collections.unmodifiableCollection(list);
     }
+    
+    static String RT_ROOT = "srs/demo/root";
+    static String RT_BLOG_HOME = "srs/demo/blog/home";
+    static String RT_BLOG_FOLDER = "srs/demo/blog/folder";
+    static String RT_BLOG_POST = "srs/blog/post";
+    
 }
\ No newline at end of file