Re: [SOLVED] NSNumberFormatter
Re: [SOLVED] NSNumberFormatter
- Subject: Re: [SOLVED] NSNumberFormatter
- From: Ingenieurbüro Birnfeld - Oliver Birnfeld <email@hidden>
- Date: Mon, 15 Jul 2013 16:32:17 +0200
- Organization: Ingenieurbüro Birnfeld
Hi Christoph,
use the "validateKey" mechanism (where "Key" is the name of property, e.g. myNumber)
public Object validateMyNumber(Object aValue) throws NSValidation.ValidationException {
// 1. cast aValue to int (or whatever you need
// 2. write check method, e.g. SOMETHINGWRONGWITH_aValue
// throw exception, if aValue is not what you want it to be
if (SOMETHINGWRONGWITH_aValue) {
throw new NSValidation.ValidationException(aValue+" is not allowed for property 'MyNumber');
}
}
This way it works as desired, thank you!
And thanks for the links!
Regards,
Oliver
This method will be called by WO automatically before the settermethod setMyNumber is called.
Or you overwrite "validateForSave" or "validateForUpdate" in your entity's class (which should be a subclass of EOCustomObject).
For more basic information see:
https://developer.apple.com/legacy/library/#documentation/WebObjects/Enterprise_Objects/BusinessLogic/BusinessLogic.html#//apple_ref/doc/uid/TP30001011-CH204-DontLinkElementID_12
or the documentation of NSValidation
http://wocommunity.org/documents/javadoc/WebObjects/5.4.2/com/webobjects/foundation/NSValidation.html
or the documentation of EOCustomObject
http://wocommunity.org/documents/javadoc/WebObjects/5.4.2/com/webobjects/eocontrol/EOCustomObject.html#validateForUpdate()
Hope, this helps ...
C.U.CW
--
Mit freundlichen Grüßen,
Oliver Birnfeld
Ingenieurbüro Birnfeld UG (haftungsbeschränkt)
Tel.: +49.221.6605118
Fax: +49.221.6605119
Email: email@hidden
http://www.ingenieurbuero-birnfeld.de
XING: http://www.xing.com/profile/Oliver_Birnfeld
facebook: https://www.facebook.com/ingenieurbuerobirnfeld
Gulp: http://www.gulp.de/Profil/ibb-koeln.html
Elance: https://www.elance.com/s/ibb-koeln/
Sitz der Gesellschaft: Köln
Rechtsform: UG (haftungsbeschränkt)
Eingetragen beim Amtsgericht Köln
Handelsregister: HRB 77830
Steuernummer: 218/5720/1867
USt.-ID: DE288802207
Geschäftsführer: Oliver Birnfeld
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden