Add prototype pattern in Java