myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gcrawf...@apache.org
Subject svn commit: r1099932 - in /myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces: generator/component/TrinidadComponentGenerator.java parse/PropertyBean.java
Date Thu, 05 May 2011 19:28:11 GMT
Author: gcrawford
Date: Thu May  5 19:28:11 2011
New Revision: 1099932

URL: http://svn.apache.org/viewvc?rev=1099932&view=rev
Log:
TRINIDAD-2094 support adding mutable information to property key in the trinidad tools

Modified:
    myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java
    myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java

Modified: myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java?rev=1099932&r1=1099931&r2=1099932&view=diff
==============================================================================
--- myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java
(original)
+++ myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java
Thu May  5 19:28:11 2011
@@ -20,6 +20,7 @@ package org.apache.myfaces.trinidadbuild
 
 import java.io.IOException;
 
+import java.lang.IllegalArgumentException;
 import java.lang.reflect.Modifier;
 
 import java.util.ArrayList;
@@ -134,6 +135,7 @@ public class TrinidadComponentGenerator 
           propClass = "String";
         }
         String propDefault = property.getDefaultValue();
+        String propMutable = _getPropertyMutable(property);
 
         if (!"Object".equals(propClass) || propDefault != null)
         {
@@ -141,6 +143,10 @@ public class TrinidadComponentGenerator 
           String boxedClass = Util.getBoxedClass(propClass);
           out.print(", " + boxedClass + ".class");
         }
+        else if (propMutable != null)
+        {
+          out.print(", Object.class");
+        }
 
         if (propDefault != null)
         {
@@ -151,11 +157,26 @@ public class TrinidadComponentGenerator 
           else
             out.print(", " + convertStringToBoxedLiteral(propClass, propDefault));
         }
+        else if (propMutable != null)
+        {
+          out.print(", null");
+        }
 
         // property capabilities
         String propCaps = _getPropertyCapabilities(property);
+
         if (propCaps != null)
           out.print(", " + propCaps);
+
+        if (propMutable != null)
+        {
+          if (propCaps == null )
+            out.print(", 0");
+
+          out.print(", " + propMutable);
+        }
+
+
         out.println(");");
       }
       out.unindent();
@@ -395,6 +416,31 @@ public class TrinidadComponentGenerator 
     out.println("}");
   }
 
+  private String _getPropertyMutable(
+    PropertyBean property)
+  {
+    String mutable = property.getMutable();
+
+    if (mutable == null || "immutable".equals(mutable))
+      return null;
+
+    if ("rarely".equals(mutable))
+    {
+      return "PropertyKey.Mutable.RARELY";
+    }
+    else if ("sometimes".equals(mutable))
+    {
+      return "PropertyKey.Mutable.SOMETIMES";
+    }
+    else if ("often".equals(mutable))
+    {
+      return "PropertyKey.Mutable.OFTEN";
+    }
+
+    throw new IllegalArgumentException("unknown mutable property \"" + mutable + "\", supported
types are immutable, rarely, sometimes, and often");
+
+  }
+
   private String _getPropertyCapabilities(
       PropertyBean property)
   {
@@ -421,11 +467,6 @@ public class TrinidadComponentGenerator 
       caps.add("PropertyKey.CAP_LIST");
     }
 
-    if (property.isMutable())
-    {
-      caps.add("PropertyKey.CAP_MUTABLE");
-    }
-
     if (caps.isEmpty())
       return null;
 

Modified: myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java?rev=1099932&r1=1099931&r2=1099932&view=diff
==============================================================================
--- myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java
(original)
+++ myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java
Thu May  5 19:28:11 2011
@@ -130,22 +130,22 @@ public class PropertyBean extends Attrib
   }
 
   /**
-   * Sets the mutable flag of this property.
+   * Sets the mutable value of this property.
    *
-   * @param mutable  the property mutable flag
+   * @param mutable  the property mutable value
    */
   public void setMutable(
-    boolean mutable)
+    String mutable)
   {
     _mutable = mutable;
   }
 
   /**
-   * Returns mutable flag of this property.
+   * Returns mutable value of this property.
    *
-   * @return  the property mutable flag
+   * @return  the property mutable value
    */
-  public boolean isMutable()
+  public String getMutable()
   {
     return _mutable;
   }
@@ -572,7 +572,7 @@ public class PropertyBean extends Attrib
   private boolean _stateHolder;
   private boolean _transient;
   private boolean _list;
-  private boolean _mutable;
+  private String  _mutable;
   private boolean _tagAttributeExcluded;
   private boolean _enum;
   private boolean _useMaxTime;



Mime
View raw message