Translate

New Live Courses

🚀 *Gen AI Engineer Telugu (Production Focused)*
🗓️ *Date:* 30th Sept 2026, 07:00AM IST
📝 *Register Now!:*
https://www.vlrt.in/gr
👥 *Join WA Community:*
https://www.vlrt.in/gw
💡*Course Content:*
https://www.vlrt.in/ai
▶️ *Demo Videos:*
https://www.vlrt.in/gv

🚀 *Service now Admin/ Development (ITSM)FREE Demo in Telugu*
🗓️ *Date:* 30th Sept 2026, 08:00AM IST
📝 *Register Now!:*
https://www.vlrt.in/7r
👥 *Join WA Community:*
https://www.vlrt.in/7w
💡*Course Content:*
https://www.vlrt.in/7c
▶️ *Demo Videos:*
https://www.vlrt.in/7v

🚀 *Vulnerability Management Training Demo*
🗓️ *Date:* 30th Sept 2026, 09:00 AM IST
📝*Register Now!:*
https://www.vlrt.in/vr
👥 *Join Community:*
https://www.vlrt.in/cw
💡 *Course Content:*
https://www.vlrt.in/vc
▶️ *Demo Videos:*
https://www.vlrt.in/Vm

Wednesday, 6 October 2021

Working with Builders ObjectGraphBuilder in Groovy Scripting groovy training telugu 64

 Watch This Video

https://youtu.be/PYwziwU6FjQ

---------------------------------------------------------------------------------


//objgraph.groovy

import groovy.transform.ToString

@ToString(includeNames = true)
class Book{
    String title
    String summary
    List<Section> sections =[]

}
@ToString(includeNames = true)
class Section{
    String title
    List<Chapter> chapters =[]
}
@ToString(includeNames = true)
class Chapter{
    String title
}

//Java Style
/*public Book createBook(){
    Book b=new Book();
    b.setTitle("My Book")
    b.setSummary("My Summary")

    Section s =new Section();
    s.setTitle("Section 1")

    Chapter c1=new Chapter();
    c1.setTitle("Chapter 1");
    Chapter c2=new Chapter();
    c2.setTitle("Chapter 2");

    s.addChapters(c1,c2);
    b.getSections().add(s)

    return book;
   }
 */

ObjectGraphBuilder builder= new ObjectGraphBuilder()
def book= builder.book(
    title:"Groovy is Action ",
    summary:"Groovy is  section "){
    section(title:"Section 1"){
        chapter(title:"Chapter 1")
        chapter(title:"Chapter 2")
        chapter(title:"Chapter 3")

    }
    section(title:"Section 2"){
        chapter(title:"Chapter 4")
        chapter(title:"Chapter 5")
        chapter(title:"Chapter 6")

    }
}
println book






No comments:

Post a Comment

Note: only a member of this blog may post a comment.