This video is an exercise about implementing the Decorator pattern and having the framework utilize it.
- [Instructor] So, we've talked at a high … level about the decorator and how it's used. … Let's jump into code and take a … look at its actual implementation. … We're going to start with our base package in scr/main/java. … And we're going to create a new package. … This time, called decorator. … Now, one of the easiest examples to use … of a decorator is the concept of a pizza. … And that's what we're going to do. … So, we will create a class of Name: Pizza. … And we will make that class abstract. … Now, we're going to add a protected … string on here, called description. … And then we will create a public string, … getDescription method, that will return that description. … Then we're going to put a public abstract method, … that returns a BigDecimal, called getCost. … Okay. … So, now we've got our pizza. … So, let's create a concrete instance of a pizza. … And we will create a ThickCrustPizza. … Now, we're going to extend Pizza here. … And we will create a public ThickCrustPizza constructor. …
AuthorFrank P Moley III
- The patterns of the Spring framework
- Creational patterns in Spring
- The adapter and decorator pattern in action
- Structural patterns in Spring
- The repository pattern in action
- The observer, command, and mediator patterns
Skill Level Intermediate
What you should know1m 28s
1. Design Patterns and Spring
2. Creational Patterns in Spring
3. Structural Patterns in Spring
4. Operational Patterns in Spring
5. Other Framework Patterns in Spring
Next steps3m 27s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.