Design pattern, for java