I assume the switch statements are in the class with the private member and
you want to externalize the decision making logic?
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.
Encapsulation is getting in your way; you want external knowledge of an
internal private member.
On 10 February 2012 11:26, Swindells, Thomas <TSwindells(a)nds.com> wrote:
> -----Original Message-----
> From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-
> bounces(a)lists.jboss.org] On Behalf Of ehmkey
> Sent: 10 February 2012 11:18
> To: rules-users(a)lists.jboss.org
> Subject: Re: [rules-users] [rules-user] problem with private members (no
> getters)
>
> I have a big switch case construction and i want to replace that with a
rule
> based system.
>
> In the switch case are functions and they have parameters. Some of this
> parameters are private.
> The only idea i had was that i can create methods and call the methods
with
> the rules.
>
> e.g the key of the switch-case is private, and i dont need and wont a
getter
> for this
[Swindells, Thomas] you need it if you are going to use it in rules in any
sensible way,
My advice is just to make a public getter and if necessary shove a big DO
NOT USE in the javadoc.
If you try you may be able to get away to limiting the scope to package as
long as the rules
file is also in the same package.
Depending on how the objects are created/used in the rest of your
application you
may be able to write an interface to define the public methods and only
your drools code
uses/has access to the actualy implementation class
Thomas
**************************************************************************************
This message is confidential and intended only for the addressee. If you
have received this message in error, please immediately notify the
postmaster(a)nds.com 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.
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
**************************************************************************************
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users