• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
EOGenerator templates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EOGenerator templates


  • Subject: EOGenerator templates
  • From: Greg Hulands <email@hidden>
  • Date: Thu, 21 Oct 2004 08:46:50 +1000

Hi,
I am trying to add automatic validating to any string attribute by making sure that the length of the string won't excced the width of the attribute.
The problem I am having is trying to get the comparison correct. I have tried == with no luck. I also have tried NSString instead of java.lang.String.


<$if Attribute.className.isEqualToString("java.lang.String")$>
public Object validate<$Attribute.name.initialCapitalString$>(Object value) {
String str = (String)value;
EOEntity <$classNameWithoutPackage$> = EOModelGroup.defaultGroup().entityNamed(entityName());
EOAttribute attr<$Attribute.name.initialCapitalString$> = <$classNameWithoutPackage$>.attributeNamed("<$Attribute.name$>");


if (str.length() > attr<$Attribute.name.initialCapitalString$>.width()) {
return str.substring(0, attr<$Attribute.name.initialCapitalString$>.width() - 1);
}
return str;
}
<$endif$>


Does anyone know if this is possible?

Greg

_______________________________________________
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


  • Follow-Ups:
    • Re: EOGenerator templates
      • From: David Aspinall <email@hidden>
  • Prev by Date: Re: EOSortOrdering numerical question
  • Next by Date: authentication
  • Previous by thread: Re: EOSortOrdering numerical question
  • Next by thread: Re: EOGenerator templates
  • Index(es):
    • Date
    • Thread