[jira] Commented: (CAY-1065) Add registerNewObjects() method to DataContext

From: Robert Zeigler (JIRA) ("Robert)
Date: Wed Jun 04 2008 - 10:27:52 EDT

  • Next message: Andrey Razumovsky (JIRA): "[jira] Commented: (CAY-436) In modeler, change default object relationship delete rule"

        [ https://issues.apache.org/cayenne/browse/CAY-1065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907#action_12907 ]

    Robert Zeigler commented on CAY-1065:
    -------------------------------------

    I suppose it depends on how the method is implemented, but, assuming a simple implementation:
    registerNewObjects(Collection objs) {
      for(Object obj : objs) {
        registerNewObject(obj);
      }
    }

    you could widen the type even further , to: registerNewObjects(Iterable objs)

    Sadly, arrays seem to be "special cased" for the enhanced for loop, rather than implementing "iterable".
    None-the-less, it's easy to turn an array into a list w/ java 5:
    registerNewObjects(Arrays.asList(myArray));

    So you could, in theory at least, have a single method, rather than two.

    > Add registerNewObjects() method to DataContext
    > ----------------------------------------------
    >
    > Key: CAY-1065
    > URL: https://issues.apache.org/cayenne/browse/CAY-1065
    > Project: Cayenne
    > Issue Type: New Feature
    > Components: Cayenne Core Library
    > Affects Versions: 3.0
    > Environment: N/A
    > Reporter: Michael Gentry
    > Assignee: Michael Gentry
    > Priority: Minor
    > Fix For: 3.0
    >
    >
    > Add registerNewObjects() method to DataContext which is a cover method which calls registerNewObject(). Make at least two methods:
    > void registerNewObjects(List objects)
    > void registerNewObjects(Object[] objects)

    -- 
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
    



    This archive was generated by hypermail 2.0.0 : Wed Jun 04 2008 - 10:28:16 EDT