Hello,

I have an Entity named Login. It has an attribute named webBroswerInfo that is a string. Is there any way for me to determine in code he maximum size of that string? What I would like to do is have a validation method that checks the size of the string and then truncates the string if it is above the max length for the attribute. I would like a way to do this dynamically rather then hard coding the max max value.

For instance:

I currently have this:

public String webBrowserInfo(String value) throws NSValidation.ValidationException {
        if(value.length() > 255){
                value = value.substring(0, 254);
        }

        return value;
}

I would rather have something like this:

public String webBrowserInfo(String value) throws NSValidation.ValidationException {
        if(value.length() > WEB_BROWSER_INFO_MAX_LENGTH){
                value = value.substring(0, WEB_BROWSER_INFO_MAX_LENGTH);
        }

        return value;
}

I would like to be able to change the max length in the EOModel and not have to worry about changing code. I suspect that there is a way to do this but I am perhaps looking in the wrong place.

Regards,
Jeff

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to