| 36 | } |
| 37 | |
| 38 | public class Applicator { |
| 39 | public static void apply(Processor p, Object s) { |
| 40 | System.out.println("Using Processor " + p.name()); |
| 41 | System.out.println(p.process(s)); |
| 42 | } |
| 43 | public static void main(String[] args) { |
| 44 | String s = |
| 45 | "We are such stuff as dreams are made on"; |
| 46 | apply(new Upcase(), s); |
| 47 | apply(new Downcase(), s); |
| 48 | apply(new Splitter(), s); |
| 49 | } |
| 50 | } |
| 51 | /* Output: |
| 52 | Using Processor Upcase |
| 53 | WE ARE SUCH STUFF AS DREAMS ARE MADE ON |
nothing calls this directly
no outgoing calls
no test coverage detected