|
From: Anna C. <ac...@er...> - 2004-03-10 21:22:44
|
Keith I don't think that the Spring IoC configuration is a valid one according to http://www.springframework.org/dtd/spring-beans.dtd Anna -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of Keith Donald Sent: Wednesday, March 10, 2004 8:10 AM To: spr...@li... Subject: Re: [Springframework-developer] declarative rules-based bean validator w/ attributes in sandbox Correct me if I'm wrong, but I don't think there is. However, I know if you're using Eclipse, the sandbox code (including tests) automatically gets incrementally compiled in target/other-classes, which is automatically put in the classpath. So I have been basically running everything in the sandbox from Eclipse directly. Keith ----- Original Message ----- From: <sam...@ma...> To: <spr...@li...> Sent: Wednesday, March 10, 2004 6:42 AM Subject: RE: [Springframework-developer] declarative rules-based bean validator w/ attributes in sandbox > Excellent, thanks Keith. On the subject of the sandbox, is there a build > directive to buils the sandbox code, or should I just overwrite the src with the > sandbox code and rebuild? > > sam > > Quoting Keith Donald <kd...@cs...>: > > > I checked in a "BeanValidatorBuilder" class in the sandbox under > > validation.support that allows you to declaratively assign > > PropertyValidationRules to bean properties via Spring-IoC, through a > > scripting environment such as Groovy/Beanshell, or programatically in = > > plain > > java. This is in addition to support for defining validation rules on = > > beans > > via source markup. > > > > Here's an example on how to use it: > > > > Spring IoC configuration > > > > <bean id=3D"validatorBuilder" > > class=3D"org.springframework.validation.support.ValidatorBuilder"/> > > <constructor-arg index=3D"0"> > > <description>The validated bean type (class or > > interface) aka 'root entity'</description> > > <value>org.springframework.validation.Pet</value> > > </constructor-arg> > > <map> > > <description> > > A map of property name keys to one or more > > governing property validation rules. > > Nested bean property names from the 'root > > entity' are supported. > > Rule instances may be reused across > > properties if desired. > > </description> > > <entry key=3D"name.lastName"> > > <value><bean > > class=3D"org.springframework.validation.rules.Required"/></value> > > </entry> > > <entry key=3D"favoriteToy"> > > <value> > > <set> > > <bean > > class=3D"org.springframework.validation.rules.Required"/> > > <bean > > class=3D"org.springframework.validation.rules.MaxLength"> > > =09 > > <constructor-arg>25</constructor-arg> > > > > </bean> > > </set> > > </value> > > </entry> > > </map> > > </bean> > > > > Java > > > > BeanValidatorBuilder builder =3D new = > > BeanValidatorBuilder(Pet.class); > > > > builder.setPropertyValidator("name.lastName", new Required()); > > > > Set toyRules =3D new HashSet(); > > toyRules.add(new Required()); > > toyRules.add(new MaxLength(255)); > > builder.setPropertyValidator("favoriteToy", toyRules); > > > > Keith > > sam > http://www.magpiebrain.com/ > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |