modmouse Posted January 3, 2012 Posted January 3, 2012 public void setType(char aType) throws DishException { if(aType.length() == 0) throw new DishException ("A dish type must be entered"); type = aType; }ERROR: object type required, but char found.[/CODE]I am using jbuilder 3 and I am aware I am using the wrong validation but since I'm unsure what is the correct method to use for char type validation I'm here to see what help I can get.Since I've not covered char before this is new too me.This is the only validation error I am having others are intiger and string without any errors. I have to keep it as character and not change it.Thanks in advance. Quote
Sparda Posted January 3, 2012 Posted January 3, 2012 char is a Java primitive type, and thus not an actual object. If you where to change it to be a String or some thing that error would go away, and, in fact, String is possibly the type it's meant to be since the length method is used. Admittedly it could be nearly any object, but String length method has meaning (String is an object btw). Quote
modmouse Posted January 4, 2012 Author Posted January 4, 2012 Thanks, I also want validation to check not at the end of entering a set of data but after each piece of data has been added how best would I be able to do this? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.