|
From: Rod J. <ro...@in...> - 2004-10-04 20:52:03
|
Have to say that this looks to me like it's making a case for an = expression language instead of a FactoryBean.=20 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"=20 > 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=20 > 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"=20 > = 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 |
|
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 |
|
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 > > |
|
From: Dmitriy K. <dko...@ru...> - 2004-10-04 21:53:02
|
Rod, if it's not a secret, what strategy did you use to configure a constant value via a property? Did you utilize org.springframework.core.Constants class in conjunction with MethodInvokingFactoryBean? +1 for support to easily evaluate a constant in application context. Regards, Dmitriy. Rod Johnson wrote: >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 > > |