There's also a quirk regarding the class resolution:-
Given Person class:-
package com.guvnor.domain;
import java.math.BigDecimal;
public class Person {
private BigDecimal salary;
public BigDecimal getSalary() {
return salary;
}
public void setSalary(BigDecimal salary) {
this.salary = salary;
}
}
The following compiles OK:-
package com.sample
import com.guvnor.domain.Person
declare Person
end
However the following does not (without explicitly importing
java.math.BigDecimal - which is a field type in Person):-
package com.sample
import com.guvnor.domain.Person
import com.guvnor.domain.Address
declare Person
end
declare Person2 extends Person
flange : String
end
Error being "Unknown DroolsError class
org.drools.compiler.TypeDeclarationError: Unable to find class 'BigDecimal'
".
With kind regards,
Mike
On 11 July 2011 08:41, Wolfgang Laun <wolfgang.laun(a)gmail.com> wrote:
Subsection 5.7.7 discusses 'extends' and describes how it is
done for types
declared in Java.
One finesse is apparently not documented: Java types must be proper
JavaBeans; otherwise the construction of the accessors will fail. (Try, for
instance, a property with a getter but no matching setter.)
HTH
-W
On 10 July 2011 22:29, Michael Anstis <michael.anstis(a)gmail.com> wrote:
> What's the rules around declared types extending another (declared) type?
>
> I've been asked to provide for declared type extension in Guvnor (by
> Prakash) but the Expert user-guide doesn't say it exists at the engine
> level.
>
> I tried "declare MyType extends java.util.ArrayList" and received a
> parser\compiler error stating "java.util.ArrayList was not a declared
type"
> (or words to that effect) so some form of extension appears possible.
>
> Thanks,
>
> Mike
>
> _______________________________________________
> rules-dev mailing list
> rules-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev