|
From: Dmitriy K. <dko...@ru...> - 2004-10-05 12:31:50
|
FieldRetrievingFactoryBean looks great! Dmitriy. jürgen höller [werk3AT] wrote: >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. > >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). > >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="myField" class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"> > <property name="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="java.sql.Connection.TRANSACTION_SERIALIZABLE" class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"/> > >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ürgen höller [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="tb" >>class="org.springframework.beans.TestBean" singleton="false"> >> <property name="age"><value>10</value></property> >> <property name="spouse"> >> <bean class="org.springframework.beans.TestBean"> >> <property name="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="propertyPath1" >> >> >class="org.springframework.beans.factory.config.PropertyPathFactoryBean"> > > >> <property name="targetObject"> >> <bean class="org.springframework.beans.TestBean"> >> <property name="age"><value>12</value></property> >> </bean> >> </property> >> <property name="propertyPath"><value>age</value></property> >></bean> >> >>// will result in 11, which is the value of property 'spouse.age' of bean >> >> >'tb' > > >><bean id="propertyPath2" >> >> >class="org.springframework.beans.factory.config.PropertyPathFactoryBean"> > > >> <property name="targetBeanName"><value>tb</value></property> >> <property name="propertyPath"><value>spouse.age</value></property> >></bean> >> >>// will result in 10, which is the value of property 'age' of bean 'tb' >><bean id="tb.age" >>class="org.springframework.beans.factory.config.PropertyPathFactoryBea >>n"/> >> >> >>The last one, interpreting the bean name as 'beanName.property' pattern, is >> >> >quite concise... > > >> >> > > > > >------------------------------------------------------- >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 > > > > >------------------------------------------------------- >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 > > |