I assume the switch statements are in the class with the private member and you want to externalize the decision making logic?<br><br>Consider if you did not use rules but simply wanted to move the switch statements from the containing class to a utility class you'd be presented with the same issue.<br>
<br>Encapsulation is getting in your way; you want external knowledge of an internal private member.<br><br><div class="gmail_quote">On 10 February 2012 11:26, Swindells, Thomas <span dir="ltr"><<a href="mailto:TSwindells@nds.com">TSwindells@nds.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
<br>
> -----Original Message-----<br>
> From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-">rules-users-</a><br>
> <a href="mailto:bounces@lists.jboss.org">bounces@lists.jboss.org</a>] On Behalf Of ehmkey<br>
> Sent: 10 February 2012 11:18<br>
> To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> Subject: Re: [rules-users] [rules-user] problem with private members (no<br>
> getters)<br>
><br>
> I have a big switch case construction and i want to replace that with a rule<br>
> based system.<br>
><br>
> In the switch case are functions and they have parameters. Some of this<br>
> parameters are private.<br>
> The only idea i had was that i can create methods and call the methods with<br>
> the rules.<br>
><br>
> e.g the key of the switch-case is private, and i dont need and wont a getter<br>
> for this<br>
</div>[Swindells, Thomas] you need it if you are going to use it in rules in any sensible way,<br>
My advice is just to make a public getter and if necessary shove a big DO NOT USE in the javadoc.<br>
If you try you may be able to get away to limiting the scope to package as long as the rules<br>
file is also in the same package.<br>
<br>
Depending on how the objects are created/used in the rest of your application you<br>
may be able to write an interface to define the public methods and only your drools code<br>
uses/has access to the actualy implementation class<br>
<br>
Thomas<br>
<br>
<br>
**************************************************************************************<br>
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the <a href="mailto:postmaster@nds.com">postmaster@nds.com</a> and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.<br>
<br>
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00<br>
**************************************************************************************<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br>