Davide,
Thanks for your responses and for re-opening the JIRA.
Although I get warnings about accessing FieldDefinition and
AnnotationDefinition due to restriction on the
drools-core-5.4.0.Final.jar library, it does work to cast FactField to
FieldDefinition and use its methods to access the AnnotationDefinitions.
Regarding your other suggestion, I was able to use Java reflection to
get the FactType annotations (factType.getFactClass().getAnnotations()).
However, I was not able to use Java reflection to obtain the field
annotations. I successfully used
factType.getFactClass().getDeclaredFields() to get the Fields. But then
using field.getClass().getAnnotations() on each Field did not return any
annotations. Using the debugger, I can see that the
factType.definedClass.declaredFields.referent[0].annotations variable is
not null and is null for referent[1] and referent[2] where each referent
is a Field. I do not know how to interpret the contents of the Field's
annotations variable, but at least it is not null for the first Field
which seems correct since I have a DRL field annotation on the first
field and not on the next 2.
Thanks again for your help.
Phil
From: Davide Sottara [via Drools]
[mailto:ml-node+s46999n4019373h56@n3.nabble.com]
Sent: Thursday, August 23, 2012 1:29 PM
To: Courtney, Phil
Subject: Re: Accessing FactField Metadata
Phil,
also consider that getDefinedClass().getAnnotations() will give you the
>JAVA<< annotations.
Any custom Drools metadata which
is not mapped into a java annotation
(e.g. @role) will not
be visible from there.
________________________________
If you reply to this email, your message will be added to the discussion
below:
http://drools.46999.n3.nabble.com/Accessing-FactField-Metadata-tp4019366
p4019373.html
To unsubscribe from Accessing FactField Metadata, click here
<
http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubs
cribe_by_code&node=4019366&code=UGhpbGlwX0NvdXJ0bmV5QHNyYS5jb218NDAxOTM2
Nnw4OTA2NzAxNjM=> .
NAML
<
http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_
viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces
.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web
.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.
naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3A
email.naml>
--
View this message in context:
http://drools.46999.n3.nabble.com/Accessing-FactField-Metadata-tp4019366p...
Sent from the Drools: User forum mailing list archive at
Nabble.com.