|
From: <jue...@we...> - 2004-10-05 07:06:02
|
Well, effectively we already *have* a built-in kind of expression = language: BeanWrapper's property path evaluation capabilities, roughly = following JSTL EL syntax. All that PropertyPathFactoryBean does is = evaluate such BeanWrapper-style property paths on a given target bean. =20 I guess that's as convenient as you can get without the BeanFactory = knowing about what's going on here (i.e. without the core factory = knowing about expressions). =20 Regarding constants: Since 1.1 RC2, we have a FieldRetrievingFactoryBean = which can be used to retrieve static fields: // standard definition for exposing a static field, specifying the = "staticField" property <bean id=3D"myField" = class=3D"org.springframework.beans.factory.config.FieldRetrievingFactoryB= ean"> <property = name=3D"staticField"><value>java.sql.Connection.TRANSACTION_SERIALIZABLE<= /value></property> </bean> // convenience version that specifies a static field pattern as bean = name (since 1.1.2) <bean id=3D"java.sql.Connection.TRANSACTION_SERIALIZABLE" = class=3D"org.springframework.beans.factory.config.FieldRetrievingFactoryB= ean"/> If it's just about the odd constant in your XML bean definitions, this = should be good enough. Of course, full-fledged scripting support *is* = desirable for needs that go beyond that: for example, to specify entire = bean definitions in scripts. I see those as two different goals, though. Juergen ________________________________ Von: spr...@li... im Auftrag = von Rod Johnson Gesendet: Mo 04.10.2004 22:51 An: spr...@li... Betreff: RE: [Springframework-developer] PropertyPathFactoryBean Have to say that this looks to me like it's making a case for an = expression language instead of a FactoryBean. A similar requirement that would also be well addressed by = OGNL/whatever: evaluating a constant. E.g. an AutowireCapableBeanFactory constant, = which I recently had to configure via a property. It would be nice to be able to = do that easily. Rgds Rod -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf = Of Colin Sampaleanu Sent: 04 October 2004 18:32 To: spr...@li... Subject: Re: [Springframework-developer] PropertyPathFactoryBean Good stuff. It overlaps of course with the mythical OGNL or expression support which keeps getting pushed back, but in the meantime provides = some of the benefits for pretty little extra code... j=FCrgen h=F6ller [werk3AT] wrote: >I've just added a PropertyPathFactoryBean, following this suggestion: > >http://opensource.atlassian.com/projects/spring/browse/SPR-343 > > >Usage examples: > > // target bean to be referenced by name <bean id=3D"tb" > class=3D"org.springframework.beans.TestBean" singleton=3D"false"> > <property name=3D"age"><value>10</value></property> > <property name=3D"spouse"> > <bean class=3D"org.springframework.beans.TestBean"> > <property name=3D"age"><value>11</value></property> > </bean> > </property> > </bean> > > // will result in 12, which is the value of property 'age' of the > inner bean <bean id=3D"propertyPath1" class=3D"org.springframework.beans.factory.config.PropertyPathFactoryBean= "> > <property name=3D"targetObject"> > <bean class=3D"org.springframework.beans.TestBean"> > <property name=3D"age"><value>12</value></property> > </bean> > </property> > <property name=3D"propertyPath"><value>age</value></property> > </bean> > > // will result in 11, which is the value of property 'spouse.age' of = bean 'tb' > <bean id=3D"propertyPath2" class=3D"org.springframework.beans.factory.config.PropertyPathFactoryBean= "> > <property name=3D"targetBeanName"><value>tb</value></property> > <property name=3D"propertyPath"><value>spouse.age</value></property> > </bean> > > // will result in 10, which is the value of property 'age' of bean = 'tb' > <bean id=3D"tb.age" > = class=3D"org.springframework.beans.factory.config.PropertyPathFactoryBea > n"/> > > >The last one, interpreting the bean name as 'beanName.property' = pattern, is quite concise... >=20 > ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal = Use IT products in your business? Tell us what you think of them. Give us = Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give = us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out = more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |