Design Pattern for java