java design pattern sample