• 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
Re: EOGenerator 1.6 array support and in/notin operators
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOGenerator 1.6 array support and in/notin operators


  • Subject: Re: EOGenerator 1.6 array support and in/notin operators
  • From: Francis Labrie <email@hidden>
  • Date: Fri, 21 Oct 2005 11:50:13 -0400

Hi Christian,


Christian Pekeler wrote:
[...]
I would like to use these new features, but there is no example and I can't get it to work:


	<$if className in ('"NSData", "NSTimestamp")$>...

This expression is accepted by EOGenerator, but it doesn't evaluate to "true" when "className" variable is "NSData" or "NSTimestamp". Is there someone that knows how to define an array and how to use it with the new "in" and "notin" operators?

I don't know how to define an array. But I've recently extended my template to only import required packages using the 'in' operator. Sounds like you might be trying to accomplish the same.

Exactly.

<$if classAttributes.@count > 0 or classToOneRelationships.@count > 0$>import com.webobjects.eocontrol.*;<$endif$><$if 'NSTimestamp' in classAttributes.javaValueClassName or classToManyRelationships.@count > 0$>
import com.webobjects.foundation.*;<$endif$><$if 'BigDecimal' in classAttributes.javaValueClassName$>
import java.math.*;<$endif$>

Thanks! With your hint, I've finally found the way to make it works! I was trying to use the "in" clause with an array of a single object, i.e.:


	<$if className in ("BigDecimal")$>

This kind of construction is not supported (bug?). The "==" operator must be used instead:

	<$if className == "BigDecimal"$>

Below is a working example. It would be far easier to manage imports if it could be possible to join arrays and filter duplicates with EOGenerator/MiscMerge:

...
<$set previousClassName = ""
$><$foreach className relationships.destinationEntity.referenceJavaClassName.@sortedStringArra y do
$><$if className != previousClassName
$><$set previousClassName = className
$><$if className == "EOEnterpriseObject"
$>import com.webobjects.eocontrol.<$className$>;
<$else
$>import <$className$>;
<$endif
$><$endif
$><$endforeach do
$><$if classToManyRelationships.count > 0
$>import com.webobjects.foundation.NSArray;
<$endif
$><$foreach className classAttributes.javaValueClassName.@sortedStringArray do
$><$if className != previousClassName$><$set previousClassName = className
$><$if (className == "NSArray" and classToManyRelationships.count == 0) or (className in ("NSData", "NSDictionary", "NSTimestamp"))
$>import com.webobjects.foundation.<$className$>;
<$elseif className == "BigDecimal"
$><import java.math.<$className$>;
<$else
$><$endif
$><$endif
$><$endforeach do
$>
...



Kind regards,

--
Francis Labrie
Saint-Bruno-de-Montarville, Quebec, Canada

_______________________________________________
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


References: 
 >EOGenerator 1.6 array support and in/notin operators (From: Francis Labrie <email@hidden>)
 >Re: EOGenerator 1.6 array support and in/notin operators (From: Christian Pekeler <email@hidden>)

  • Prev by Date: Strange behavior with checkboxes in subcomponent
  • Next by Date: Re: Strange behavior with checkboxes in subcomponent
  • Previous by thread: Re: EOGenerator 1.6 array support and in/notin operators
  • Next by thread: Strange behavior with checkboxes in subcomponent
  • Index(es):
    • Date
    • Thread