I think what you have is fine. Our generated code will always have the desired field and getValue() method.