Professional Documents
Culture Documents
Tags
Decorators are used for adding some behavior that is not part of the core
functionality to all interface methods. Decorator pattern perfectly suits for the
following tasks:
Component is the interface for the objects that will get new responsibilities
from the decorators;
Decorator 1
Code
Decorator 2
}
// concrete decorator
public class SeniorJavaDeveloper extends DeveloperDecorator {
// concrete decorator
public class JavaTeamLead extends DeveloperDecorator {
// demo
public class Task {
System.out.println(developer.makeJob());
}
}
Decorator 3
Decorator 4