directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1533800 - in /directory/escimo/trunk/json2java/src/main: java/org/apache/directory/scim/AttributeDetail.java java/org/apache/directory/scim/JsonToJava.java resources/resource-class.st
Date Sat, 19 Oct 2013 17:57:22 GMT
Author: kayyagari
Date: Sat Oct 19 17:57:22 2013
New Revision: 1533800

URL: http://svn.apache.org/r1533800
Log:
do not generate setters for read-only attributes

Modified:
    directory/escimo/trunk/json2java/src/main/java/org/apache/directory/scim/AttributeDetail.java
    directory/escimo/trunk/json2java/src/main/java/org/apache/directory/scim/JsonToJava.java
    directory/escimo/trunk/json2java/src/main/resources/resource-class.st

Modified: directory/escimo/trunk/json2java/src/main/java/org/apache/directory/scim/AttributeDetail.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/json2java/src/main/java/org/apache/directory/scim/AttributeDetail.java?rev=1533800&r1=1533799&r2=1533800&view=diff
==============================================================================
--- directory/escimo/trunk/json2java/src/main/java/org/apache/directory/scim/AttributeDetail.java
(original)
+++ directory/escimo/trunk/json2java/src/main/java/org/apache/directory/scim/AttributeDetail.java
Sat Oct 19 17:57:22 2013
@@ -32,6 +32,7 @@ public class AttributeDetail
     private String name;
     private String javaType;
     private boolean multiValued = false;
+    private boolean readOnly = false;
 
 
     public AttributeDetail( String name, String javaType )
@@ -95,6 +96,24 @@ public class AttributeDetail
     }
 
 
+    /**
+     * @return the readOnly
+     */
+    public boolean isReadOnly()
+    {
+        return readOnly;
+    }
+
+
+    /**
+     * @param readOnly the readOnly to set
+     */
+    public void setReadOnly( boolean readOnly )
+    {
+        this.readOnly = readOnly;
+    }
+
+
     @Override
     public int hashCode()
     {

Modified: directory/escimo/trunk/json2java/src/main/java/org/apache/directory/scim/JsonToJava.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/json2java/src/main/java/org/apache/directory/scim/JsonToJava.java?rev=1533800&r1=1533799&r2=1533800&view=diff
==============================================================================
--- directory/escimo/trunk/json2java/src/main/java/org/apache/directory/scim/JsonToJava.java
(original)
+++ directory/escimo/trunk/json2java/src/main/java/org/apache/directory/scim/JsonToJava.java
Sat Oct 19 17:57:22 2013
@@ -265,6 +265,8 @@ public class JsonToJava extends Abstract
 
             String name = jo.get( "name" ).getAsString();
 
+            boolean readOnly = jo.get( "readOnly" ).getAsBoolean();
+            
             String javaType = "String";
             if ( type.equals( "numeric" ) )
             {
@@ -312,10 +314,11 @@ public class JsonToJava extends Abstract
                 innerClasses.add( inner.toString() );
             }
 
-            AttributeDetail nc = new AttributeDetail( name, javaType );
-            nc.setMultiValued( multiValued );
+            AttributeDetail ad = new AttributeDetail( name, javaType );
+            ad.setMultiValued( multiValued );
+            ad.setReadOnly( readOnly );
 
-            simpleAttributes.add( nc );
+            simpleAttributes.add( ad );
         }
 
         template.setAttribute( "allAttrs", simpleAttributes );

Modified: directory/escimo/trunk/json2java/src/main/resources/resource-class.st
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/json2java/src/main/resources/resource-class.st?rev=1533800&r1=1533799&r2=1533800&view=diff
==============================================================================
--- directory/escimo/trunk/json2java/src/main/resources/resource-class.st (original)
+++ directory/escimo/trunk/json2java/src/main/resources/resource-class.st Sat Oct 19 17:57:22
2013
@@ -43,11 +43,13 @@ $visibility$ $static$ class $className$ 
 	    $endif$
     }
    
-   $allAttrs: { attr | 
+   $allAttrs: { attr |
+   $if(!attr.readOnly)$ 
     public void set$attr.methodName$( $attr.javaType$ $attr.name$ )
     {      
        this.$attr.name$ = $attr.name$;
     }
+   $endif$
    
     $if(attr.boolean)$
     public $attr.javaType$ is$attr.methodName$()



Mime
View raw message