beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremiah Johnson" <jerjo...@bea.com>
Subject RE: Should control annotation constraints be validated when compiling a ControlInterface?
Date Mon, 10 Oct 2005 15:50:32 GMT
There was a section in the Controls Programming document, at one time,
that agreed with BEEHIVE-793.  The section was removed for 1.0 because
it wasn't consistent with the state of Controls in 1.0; since it was in
there at one time, it seems like someone wanted it.

Personally, I don't want the extra validation on the interface unless
that is the only way to enforce an EXACTLY_ONE or AT_LEAST_ONE type
rule.  Seems like that is not true, though.

Here is the clip that was temporarily in the documentation:
+<p>When constraining properties with
<code>@AnnotationConstraints</code>, all of the property
+       members must be annotated
+       with <code>@AnnotationMemberTypes</code>, or compile errors will
be thrown.  For example, the following
+       will <em>not</em> compile, because not all of the property
members (namely <code>someMember3()</code>)
+       are decorated with
+               <code>@AnnotationMemberTypes</code>.</p>
+<source>
+
@AnnotationConstraints.MembershipRule(AnnotationConstraints.MembershipRu
leV
alues.EXACTLY_ONE)
+    public @interface SomeProperty
+    {
+        @AnnotationMemberTypes.Text(maxLength=8)
+        public String someMember();
+        @AnnotationMemberTypes.Text(maxLength=8)
+        public String someMember2();
+        <strong>public String someMember3();</strong>
+       }</source>
+<p>Not all Java types are supported by
<code>@AnnotationMemberTypes</code>.  For a list of the supported types
+       see <a
href="../apidocs/classref_controls/org/apache/beehive/controls/api/bean/
AnnotationMemberTypes.html">Interface AnnotationMemberTypes</a>.</p>

- jeremiah

> -----Original Message-----
> From: Chad Schoettger [mailto:chad.schoettger@gmail.com]
> Sent: Friday, October 07, 2005 3:14 PM
> To: Beehive Developers
> Subject: Should control annotation constraints be validated when
compiling
> a ControlInterface?
> 
> I was taking a look at BEEHIVE-793, "Declaring control membership
> constraint
> AT_LEAST_ONE and EXACTLY_ONE",
> which is basically an enhancement request to existing functionality.
> 
> The creator of the bug requests that the following code fail at
compile
> time:
> 
> @ControlInterface
> public interface Foo {
> @PropertySet
> @Target ({ElementType.FIELD, ElementType.TYPE})
> @Retention(RetentionPolicy.RUNTIME)
> @AnnotationConstraints.MembershipRule(
> AnnotationConstraints.MembershipRuleValues.AT_LEAST_ONE)
> public @interface Material
> {
> /*
> public Object paper;
> public Object cover;
> */
> }
> }
> 
> 
> The current behavior is that when a child control of this control is
> annotated with the 'Material' annotation its compilation will fail
with
> the
> appropriate error.
> I'm not seeing much value in this enhancement and would probably
choose to
> resolve it with a resolution of won't fix.
> 
> Anyone on the dev list have a different opinion ?? Should control
> annotation
> constraints be validated on ControlInterfaces when the
ControlInterface is
> compiled?
> 
> - Chad

________________________________________________________________________________
BEAWorld 2005: coming to a city near you.  Everything you need for SOA and enterprise infrastructure
success.

 
Register now at http://www.bea.com/4beaworld

 
London 11-12 Oct| Paris13-14 Oct| Prague18-19 Oct |Tokyo 25-26 Oct| Beijing 7-8 Dec

Mime
View raw message