myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "MyfacesBuilderPlugin" by SimonKitching
Date Tue, 18 Mar 2008 16:43:55 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by SimonKitching:
http://wiki.apache.org/myfaces/MyfacesBuilderPlugin

------------------------------------------------------------------------------
   * More desc of component (goes into tld long desc). And some more desc. Whatever.
   *
   * @mfp.component 
-  *   class = "org.apache.myfaces.component.Component" (optional; the default is this class)
+  *   class = "org.apache.myfaces.component.SomeComponent" (optional; the default is this
class)
-  *   superClass = "org.apache.myfaces.component.ComponentParent" (optional; default is parent
class)
+  *   superClass = "org.apache.myfaces.component.SomeComponentParent" (optional; default
is parent class)
   *   type = "org.apache.myfaces.Component" 
-  *   supertype = "org.apache.myfaces.ComponentParent" (the default is javax.faces.ComponentBase)
+  *   supertype = "org.apache.myfaces.SomeComponentParent" (the default is javax.faces.ComponentBase)
   *   family = "org.apache.myfaces.Component"
   *   rendererType = "org.apache.myfaces.Component"
-  *   tagClass = "org.apache.myfaces.component.ComponentTag" //Required for generation
+  *   tagClass = "org.apache.myfaces.component.SomeComponentTag" //Required for generation
   *   tagSuperClass = "javax.faces.webapp.UIComponentTag" //default is parent by type tagClass.
  **/
- public class Component extends ComponentParent {
+ public class SomeComponent extends SomeComponentParent {
  
  
    /**
@@ -119, +119 @@

     public abstract String getBaz();
  
    /**
-    * Sometimes this should be used for exclude one unwanted inherited property from the
tld.
-    * The exclusion only works for the class where is defined.
+    * Disable the getBlah property (just for instances of this type).
+    * <p>
+    * Sometimes a component inherits from another component, but does NOT want to expose
a property
+    * that the parent component exposes. For example, t:div extends t:htmlTag, but does not
want to
+    * expose the "value" property.
+    * <p>
+    * Doing this is very bad OO design; doing this breaks the Liskov substitution principle,
and
+    * therefore OO usage is completely stuffed. A subclass *must* provide all the features
of the
+    * parent type.
+    * <p>
+    * Nevertheless, some existing code does this so this feature must be supported. Providing
an
+    * mfp.property annotation with the exclude attribute causes the .tld etc to NOT define
this
+    * particular property, for this class only (child classes of this class get it again).
-    * 
+    *
-    * TODO: Leonardo, please clarify what this is for...
-    *
-    * @mfp.property
-    *   name = "parentProperty1"
-    *   exclude = "true"
+    * @mfp.property exclude = "true"
     **/
-    public abstract String getBlah();
+    public String getBlah() {
+      if (this.getClass() == SomeComponent.class) {
+         // this component does NOT support this property
+         throw new UnsupportedOperationException();
+      } else {
+        return super.getBlah();
+      }
+    }
  
    /**
     * Override the documentation for this property which was inherited from the

Mime
View raw message