If there is an interface we should be able to use it. However I
imagine the issue is that our ASM code cannot find the interfaces
.class, if its generated at runtime. As ASM just searches the classpath
for .class files. We maye have to provide a factory system so people
can provide lookups for runtime generated code, where they can pass the
byte[] themselves.
The ASM code is really only there to analyse a class so we can make fast
read methods without reflection. I expect we could also generate these
fast read methods from a configuration file, rather than needing to
analyse a bytecode.
Mark
Edson Tirelli wrote:
That would be something nice to try. I will do a test later on this.
Although, Mark, I think the class inspection to create the field
accessor is made compile time, and against the declared interface, so
I would guess it will not work... maybe we can think about supporting
dynamic method discovery in the future, maybe in a similar way as
groovy does.
Regards,
Edson
Mark Proctor wrote:
As far as I know interfaces should be fine. The ASM code that
determines fields takes it from getter methods, not from the fields
themselves. getter method order has an effect on the resulting rete
network - particularly node sharing.
Mark
Charles Lee wrote:
When I author rules do the objects have to be beans? The reason I
ask is that I have a bunch of JAXB (version 1.0) objects that get
automaticly generated. I would like to use the interfeces that it
generates for matching LHS condition. However interfaces that gets
generated don't have 'properties' that I can use for rule authoring.
At the moment in order to get the rule working I have to dig deep
into the auto-generated classes to fine the concret class and get
the property. This is not ideal as I guess the concret classes that
get generated are 'hidden' for a reason (i.e. subject to change)
For example this is my rule (a rule that gets the RNA of a DNA
sequence):
-----------------------------------------------------------------
package uk.ac.ebi.submission.rules
#This is a jaxb generated interface
import uk.ac.ebi.submission.emblentry.bind.EntryType.FeatureType;
rule "get RNA"
when
fet : FeatureType( getName() == "mRNA" )
then
System.out.println("feat name " + fet.getName());
end
-----------------------------------------------------------------
This don't work ofcource as 'fet : FeatureType( getName() == "mRNA"
)' is not valid syntax.
In order to get this rule to work I have to use the concret class
i.e. :
---------------------------------------------------------------------------------
package uk.ac.ebi.submission.rules
#Concret class
import
uk.ac.ebi.submission.emblentry.bind.impl.EntryTypeImpl.FeatureTypeImpl;
rule "get RNA"
when
fet : FeatureTypeImpl( name == "mRNA" )
then
System.out.println("feat name " + fet.getName());
end
---------------------------------------------------------------------------------
Is there a way around this? Thanks for any insight.
--Charlie