jsr344-experts@javaserverfaces-spec-public.java.net

[jsr344-experts] FacesComponent API review

From: Andy Schwartz <andy.schwartz_at_oracle.com>
Date: Wed, 13 Mar 2013 13:58:30 -0400

Trivial comments on:

Index: javax/faces/component/FacesComponent.java
===================================================================
--- javax/faces/component/FacesComponent.java (revision 8845)
+++ javax/faces/component/FacesComponent.java (revision 11719)

+ /**
+ * <p class="changed_added_2_2">If the value of this attribute is
+ * <code>true</code>, the runtime must create a Facelet tag handler,
+ * that extends from {_at_link
javax.faces.view.facelets.ComponentHandler},
+ * suitable for use in pages under the tag library with namespace given
+ * by the value of the {_at_link #namespace} attribute.</p>
+ */
+
+ boolean createTag() default false;
+
+ /**
+ * <p class="changed_added_2_2">If the value of the {_at_link #createTag}
+ * attribute is <code>true</code>, the runtime must use this
+ * value as the tag name for including an instance of the component
+ * annotated with this annotation in a view. If this attribute is not
+ * specified on a usage of this annotation, the simple name of the
+ * class on which this annotation is declared, with the first
character
+ * lowercased, is taken to be the value.</p>
+ */
+ String tagName() default "";
+
+ /**
+ * <p class="changed_added_2_2">If the value of the {_at_link #createTag}
+ * attribute is <code>true</code>, the value of this attribute is taken
+ * to be the tag library namespace into which this component is
placed.</p>
+ *
+ */
+
+ String namespace() default NAMESPACE;


Might have been nice to spec this such that if either the tag name or
the namespace is specified, the tag is created, without requiring
createTag to also be specified.

That is:

@FacesComponent(tagName="fooLayout")
public class Foo extends UIComponentBase

Results in the "fooLayout" tag being created in the default namespace.

@FacesComponent(namespace="http://my.namespace.org")
public class Foo extends UIComponentBase

Results in the "foo" tag being created in the specified namespace.

@FacesComponent(namespace="http://my.namespace.org", tagName="fooLayout")
public class Foo extends UIComponentBase

Results in the "fooLayout" tag being created in the specified namespace.

Additionally having to specify createTag=true seems unnecessary.

Andy