Here's some detail from Sotty:-
Wolfgang, still no news as to the expected behaviour :(
Sotty, I appreciate you are probably busy with other activities, however any your thoughts on the following would be most welcome:-For others interested, here's some answers already received:
- For POJOs is a field only added to the declared type if it has a getter and setter (something laune said he'd seen; email earlier in this thread)?
- Are fact-level annotations inherited?
- Are field-level annotations inherited?
- Type erasure on subclasses, if type A declares "myVar : String" and type B extends A and declaring "myVar : Integer", what should happen?
- Can declarative types extend Java POJOs and other declared types?
<sotty> yes
- For POJO's do I need to include an "empty" declaration? So "declare java.util.ArrayList end" if I want to "declare MyList extends ArrayList" in a java.util package?
<sotty> no, it should be enough to import the fqn or use it in the "extends".Thanks,
<manstis> note this is different to what is documented in the Drools Expert user-guide
Mike
On 12 July 2011 13:12, Michael Anstis <michael.anstis@gmail.com> wrote:
https://issues.jboss.org/browse/JBRULES-3133 created.On 12 July 2011 13:08, Michael Anstis <michael.anstis@gmail.com> wrote:
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@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
-WOn 10 July 2011 22:29, Michael Anstis <michael.anstis@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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev