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

[jsr344-experts] Re: FacesComponent API review

From: Edward Burns <edward.burns_at_oracle.com>
Date: Fri, 15 Mar 2013 20:00:28 -0700

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

AS> Trivial comments on:
AS> Index: javax/faces/component/FacesComponent.java
AS> ===================================================================
AS> --- javax/faces/component/FacesComponent.java (revision 8845)
AS> +++ javax/faces/component/FacesComponent.java (revision 11719)

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


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

AS> That is:

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

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

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

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

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

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

AS> Additionally having to specify createTag=true seems unnecessary.

I wanted to make the feature very much explicitly "opt-in".

Ed