From the course: Java EE 8 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Object model builder - Java EE Tutorial
From the course: Java EE 8 Essential Training
Object model builder
- In this lesson, we're going to use JSON P's object model API to create a jsonObject and a jsonArray. We'll do that by using two of the builders found within the object model API. All of our work is going to take place within our Order resource and we're going to start out by removing our customerObject, as well as our console output. Then, within the body of the resource method we can start to build out out jsonObject. This object is going to be used to create some tracking information about the order, so we'll be able to see when the order was created and see different statuses that it goes through. Let's start by building an objectBuilder and we just use the jsonObjectBuilder type and I'm going to name this objectBuilder jsonTrackingObjectBuilder. Then to create the objectBuilder we use the jsonObject and it has a createObjectBuilder method on it. Then from here we can start chaining using its fluent API, so we'll…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.