Hi friends.

I was wondering if there is some API which I am able to do this:

look at this example:

public class Student {
        private Long Id = null;
        private String firstName;
        private String lastName;

        . . .
        constructors, getters and setters
        . . .

        public String toString() {
                return lastName + ", " + firstName
        }
}

I want to set for example "firstName" and "lastName" properties
required, that if there is not data in them, then throwing an
exception: I do that mechanically like: (look at the isReadyToSave()
method)

public class Student {
        private Long Id = null;
        private String firstName;
        private String lastName;

        . . .
        constructors, getters and setters
        . . .

        public boolean isReadyToSave() {
                return firstName != null && lastName != null;
        }

        public String toString() {
                return lastName + ", " + firstName
        }
}

I dont know, something like

public class Student {
        private Long Id = null;
        @RequiredField
        private String firstName;
        @RequiredField
        private String lastName;

        . . .
        constructors, getters and setters
        . . .

        public String toString() {
                return lastName + ", " + firstName
        }
}


anyone knows something like that????????????


thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to