Java Design Pattern Code.