Not to poke holes but...

On May 13, 2011, at 9:21 AM, David Avendasora wrote:
> 
> EOQualifier haveRedHair = Student.HAIR_COLOR.eq(MyAppConstants.RED_HAIR);

Why is that an EOQualifier?

        public ERXKeyValueQualifier eq(T value) {
                return ERXQ.equals(_key, value);
        }

and

public class ERXKeyValueQualifier extends EOKeyValueQualifier implements 
IERXChainableQualifier

So Ramsey's

NSArray redheadedStudents = mySchool().students(haveRedHair.and(areActive));

Is valid if you only declare your ivars to be of the appropriate type.


Chuck



> EOQualifier areActive = Student.IS_ACTIVE.isTrue();
> NSArray redheadedStudents = 
> mySchool().students(Student.that(haveRedHair).and(areActive));
> 
> "But where did the 'that(EOQualifier)' come from?" you ask?
> 
> That's (no pun intended) the key (oh, wow. I'm on a roll!) to the 
> improvement. 
> 
> I have added the following simple method to my EOGenericRecord subclass:
> 
> public static ERXAndQualifier that(EOQualifier qualifier) {
>     return new ERXAndQualifier(new NSArray<EOQualifier>(qualifier));
> }
> 
> Basically, all this method does is coerce a standard EOQualifier into a 
> chainable one (IERXChainableQualifier) and uses a conjunction to better tie 
> the qualifier(s) to the Entity that they are qualifying. My #1 goal was to 
> make places where I use qualifiers as sentence-like as possible, and I think 
> Student.that(haveRedHair).and(areActive) is very readable.
> 
> So, what do you all think? Is there some flaw inherent in the system? Am I 
> missing something? Would it be worth putting into ERXGenericRecord?
> 
> Dave
> 
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
> 
> This email sent to [email protected]

-- 
Chuck Hill             Senior Consultant / VP Development

Come to WOWODC this July for unparalleled WO learning opportunities and real 
peer to peer problem solving!  Network, socialize, and enjoy a great 
cosmopolitan city.  See you there!  http://www.wocommunity.org/wowodc11/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to