Per our video conference today, I've been going through sail-core and
adding generics where they help.  Here's an example:

        Collection bundles = new ArrayList();
        public void addBundles(List extraBundles) {
                for(int i=0; i<extraBundles.size(); i++) {
                        bundles.add(extraBundles.get(i));
                }
        }
-->
        Collection<Bundle> bundles = new ArrayList<Bundle>();
        public void addBundles(Collection<Bundle> extraBundles) {
                bundles.addAll(extraBundles);
        }

And the foreach construct, dependent on the Collection<Bundle>
declaration, makes a bunch of other code in that class cleaner.

While I was at it, I took at another look at the PodUtils, which
benefits greatly.  I recently learned of this tip which I
incorporated,
 http://blogs.sun.com/tor/entry/code_tip_statically_check_multiple

        public static <T extends ITitleAware> T createBeanInPod(Pod pod,
                        Class<T> beanClass, String title) throws 
InstantiationException,
                        IllegalAccessException {
                T bean = beanClass.newInstance();
                // compiler knows bean has setTitle() because <T extends 
ITitleAware>
                bean.setTitle(title);
                pod.add(bean);
                return bean;
        }

And the childrenOfType() method now guarantees that the returned
collection contains the type asked for.  (This required updates to
SailBeanUtils class too.)

        public static <T> Collection<T> childrenOfType(Curnit assembledCurnit,
                        Class<T> type) {
                PodUuid rootPodId = assembledCurnit.getRootPodId();
                Pod rootPod = PodRegistry.getRegistry().getPod(rootPodId);
                return SailBeanUtils.childrenOfType(rootPod, type);
        }

-t



On 1/3/07, Scott Cytacki <[EMAIL PROTECTED]> wrote:


On Tue, 2007-01-02 at 15:17 -0800, Turadg Aleahmad wrote:
> What's the latest decision on whether sail-core is Java 1.5 or Java
> 1.4?  My understanding is that PLR is targeting JSE 5.0 now.  Any
> reason then not to use 1.5 source features in sail-core?  Generics fit
> in nicely in a lot of places.

sail-core is still using some 1.5 source features.
We still need 1.4 support for some of the CC projects, so when we use
sail-core for those projects, if the 1.5 source features aren't removed
we'll have to deal with retro-translater.

I think it would be better to revert it to 1.4 source to reduce the
complexity of the build system.

Scott



>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SAIL-Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/SAIL-Dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to