[rules-users] Unable to build constraint as '_default' is invalid

Wolfgang Laun wolfgang.laun at gmail.com
Wed Jul 27 13:19:36 EDT 2011


At first glance, the problem is with the MyType property DefaultType
_default. What are the names of the getter and setter?

Renaming the field to
   DefaultType default
with getter getDefault and setter setDefault is bound to fix the problem.

-W


2011/7/27 Eugenia Carcel <eujenia at gmail.com>

> Hi,
>
> I get the following error when I try to build and deploy:
> Unable to build constraint as  '_default' is invalid : [Rule
> name='myRuleName']
>
> It yields this error because of this pattern in my drl file:
> MyType(_default == DefaultType.YES)
>
> In my java class MyType I have something like this:
> public class MyType {
>     ....
>     @XmlAttribute(name = "default")
>     protected DefaultType _default;
>     ....
> }
>
> where DefaultType is an enum.
> Here is the hole enum class:
>
> @XmlType(name = "defaultType")
> @XmlEnum
> public enum DefaultType {
>
>     @XmlEnumValue("yes")
>     YES("yes");
>     private final String value;
>
>     DefaultType(String v) {
>         value = v;
>     }
>
>     public String value() {
>         return value;
>     }
>
>     public static DefaultType fromValue(String v) {
>         for (DefaultType c: DefaultType.values()) {
>             if (c.value.equals(v)) {
>                 return c;
>             }
>         }
>         throw new IllegalArgumentException(v);
>     }
> }
>
> Can you help me? I don't see where the problem is...
> Any suggestions are much appreciated.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110727/558e5152/attachment.html 


More information about the rules-users mailing list