Creates a getter method for the selected struct field.