[jboss-user] [JBoss Seam] - An annotation I would like to see: @Trim

EricJava do-not-reply at jboss.com
Wed Feb 6 14:08:22 EST 2008


Here's an idea / wish I've had for a long time:

Most of the fields in most of my biz objects are strings.  Usually they are strings which should always be trimmed, so most of my setter methods look like:

public void setCity(String city) {
  |   if(city == null) {
  |     this.city = null;
  |     return;
  |   }
  |   this.city = city.trim();
  | }

There's never a reason for leading or trailing space in the "city" field or the "name" field or most of the fields actually.

It would be cool to have an annotation called @Trim that I could put on set methods, which trims the string (if it's not null) before setting it.

It seems like this would be easy to do.  If I knew how Seam annotation processing worked, I would do it myself and submit it.  If anyone can give me some brief pointers of how to get started, I'll start.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127145#4127145

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127145



More information about the jboss-user mailing list