Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 2214 invoked from network); 4 May 2004 14:50:09 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 4 May 2004 14:50:09 -0000 Received: (qmail 11256 invoked by uid 500); 4 May 2004 14:49:56 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 11240 invoked by uid 500); 4 May 2004 14:49:56 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 11213 invoked from network); 4 May 2004 14:49:55 -0000 Received: from unknown (HELO snowwood.orcom.com) (208.5.50.3) by daedalus.apache.org with SMTP; 4 May 2004 14:49:55 -0000 Received: from Unknown [172.17.31.30] by snowwood.orcom.com - SurfControl E-mail Filter (4.7); Tue, 04 May 2004 08:49:50 -0600 Received: by fig.orcom.com with Internet Mail Service (5.5.2657.72) id ; Tue, 4 May 2004 08:49:51 -0600 Message-ID: From: Dmitry Sklyut To: 'Jakarta Commons Users List' Date: Tue, 4 May 2004 08:50:00 -0600 Subject: RE: JXPath question MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="--=_NextPart_ST_08_49_51_Tuesday_May_04_2004_4387" X-Mailer: Internet Mail Service (5.5.2657.72) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ----=_NextPart_ST_08_49_51_Tuesday_May_04_2004_4387 Content-Type: text/plain; charset="iso-8859-1" I haven't tried doing it that way. Give it a try. Let us know Thanks -----Original Message----- From: Paul McClure [mailto:pmcclure@paychex.com] Sent: Tuesday, May 04, 2004 10:42 AM To: Jakarta Commons Users List Subject: Re: JXPath question Thanks for the reply Dmitry, Is it possible to use an extension function in a path, like this: getValue("A / B / vt:asOf(C, $today) / D) My graph would have paths like this: A / B / C / D / E / F | C is not a normal Java Bean property - but must be accessed as 'getCAsOf(Date)' - which returns a C object that has a D property that is a normal Java Bean Property, and so on... thanks, Paul Dmitry Sklyut wrote: >Take a look at "Custom Extension Functions": > >Collections of custom extension functions can be implemented as Functions >objects or as Java classes, whose methods become extenstion functions. > >Let's say the following class implements various formatting operations: > > > public class Formats { > public static String date(Date d, String pattern){ > return new SimpleDateFormat(pattern).format(d); > } > ... > } >We can register this class with a JXPathContext: > > > context.setFunctions(new ClassFunctions(Formats.class, "format")); > ... > > context.getVariables().declareVariable("today", new Date()); > String today = > (String)context.getValue("format:date($today, 'MM/dd/yyyy')"); >You can also register whole packages of Java classes using PackageFunctions. > > >Also, see FunctionLibrary , which is a class that allows you to register >multiple sets of extension functions with the same JXPathContext. > > >-----Original Message----- >From: Paul McClure [mailto:pmcclure@paychex.com] >Sent: Tuesday, May 04, 2004 8:10 AM >To: commons-user@jakarta.apache.org >Subject: JXPath question > > >I am using JXPath to access an object graph and it is working well in >most cases. My problem is that my graph has some objects that are only >valid for a certain period of time. So these properties are accessed by >date - for example, a property 'foo' would have the getter >getFooAsOf(Date dt). There are many types of objects in the graph, but >all of them subclass a common base class. They all follow the naming >convention above. >Has anybody used JXPath for this kind of situation - I have not found a >way to add the "ValidTime" properties. I'm looking at a custom >JXPathBeanInfo class but not getting very far... >thanks, >Paul > > >----------------------------------------- >The information contained in this message may be privileged, confidential, >and protected from disclosure. If the reader of this message is not the >intended recipient, or any employee or agent responsible for delivering this >message to the intended recipient, you are hereby notified that any >dissemination, distribution, or copying of this communication is strictly >prohibited. If you have received this communication in error, please notify >us immediately by replying to the message and deleting it from your >computer. > >Thank you. Paychex, Inc. > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-user-help@jakarta.apache.org > > > > ----------------------------------------- The information contained in this message may be privileged, confidential, and protected from disclosure. If the reader of this message is not the intended recipient, or any employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. Paychex, Inc. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org ----=_NextPart_ST_08_49_51_Tuesday_May_04_2004_4387--