Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3094

ObjectGraphBuilder: allow references to be resolved lazily

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.6-rc-1, 1.5.8
    • 1.6-rc-2, 1.5.8, 1.7-beta-1
    • None
    • None

    Description

      ObjectGraphBuilder currently resolves references in a sequential way, referenced nodes must be defined prior to being referenced by other nodes.
      Example:

            def company = builder.company( name: 'ACME', employees: [] ) {
               address( line1: '123 Groovy Rd', zip: 12345, state: 'JV', id: 'a1' )
               employee(  name: 'Duke', employeeId: 1, id: 'e1' ) {
                  address( a1 ) // or address( refId: 'a1' )
               }
            }
      

      This improvement will allow the following case

            def company = builder.company( name: 'ACME', employees: [] ) {
               employee(  name: 'Duke', employeeId: 1, id: 'e1' ) {
                  address( refId: 'a1' ) // note that refId must be a String!
               }
               address( line1: '123 Groovy Rd', zip: 12345, state: 'JV', id: 'a1' )
            } 
      

      Attachments

        Activity

          People

            aalmiray Andres Almiray
            aalmiray Andres Almiray
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: