[ http://issues.apache.org/jira/browse/BEEHIVE-210?page=history ]
Hoi Lam reassigned BEEHIVE-210:
-------------------------------
Assign To: James Song (was: Hoi Lam)
There was a misunderstanding on what will be checked for control property
membership constraint violations. The validation is performed on control
clients that instantiate controls declaratively where property values are
specified in the declaration.
Suppose I have the following control declared with a property set that has a
membership constraint of ALL_IF_ANY:
@ControlInterface
public interface Hello
{
@PropertySet
@MembershipRule(MembershipRuleValues.ALL_IF_ANY)
@Target ({ElementType.FIELD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Person
{
@AnnotationMemberTypes.Text(maxLength=8)
public String name() default "";
@AnnotationMemberTypes.Date(minValue="1900/1/1")
public String dob() default "";
@AnnotationMemberTypes.Int (maxValue=130)
public int age() default AnnotationMemberTypes.OPTIONAL_INT;
}
}
Now, in my control client, I instantiate the control declaratively:
public class HelloClient
{
@Control
@Person(name="Test", dob="1932/2/3", age=23)
public Hello myHello;
}
When HelloClient is built, the Control APT will check for any control property
membership constraint violations. In the above example, since all members of
@Person has a value, there will be no build errors. However, if for example I
do not specify a value for the member, name:
@Control
@Person(dob="1990/2/3", age=15)
public Hello myHello;
An error will occur during build because the membership rule for @Person is
ALL_IF_ANY.
> control property constraint .MembershipRule.ALL_IF_ANY
> ------------------------------------------------------
>
> Key: BEEHIVE-210
> URL: http://issues.apache.org/jira/browse/BEEHIVE-210
> Project: Beehive
> Type: Bug
> Components: Controls
> Versions: V1Beta
> Reporter: James Song
> Assignee: James Song
> Fix For: V1Beta
>
> AnnotationConstraints.MembershipRule(AnnotationConstraints.MembershipRuleValues.ALL_IF_ANY)
> does not work.
> Test
> control:org.apache.beehive.controls.test.controls.property.constraint.PersonControl;
> For code:
>
> @AnnotationConstraints.MembershipRule(AnnotationConstraints.MembershipRuleValues.ALL_IF_ANY)
> public @interface Address
> {
> @AnnotationMemberTypes.Text(maxLength=8)
> public String street() default "";
> @AnnotationMemberTypes.Text(maxLength=8)
> public String city() default "";
> @AnnotationMemberTypes.Text(maxLength=8)
> public String province();
> //public String province() default "";
> //Test ALL_IF_ANY
> @AnnotationMemberTypes.Int(minValue=0, maxValue=100000)
> public int zipcode() default 0;
> }
> province has no default value.
> There is no compile/build error.
> Runtime value for province is null.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira