oneof.go 426 B

12345678910111213141516171819
  1. package java
  2. const oneOfConstTpl = `
  3. {{ range .Fields }}{{ renderConstants (context .) }}{{ end }}
  4. `
  5. const oneOfTpl = `
  6. switch (proto.get{{camelCase .Name }}Case()) {
  7. {{ range .Fields -}}
  8. case {{ oneof . }}:
  9. {{ render (context .) }}
  10. break;
  11. {{ end -}}
  12. {{- if required . }}
  13. default:
  14. io.envoyproxy.pgv.RequiredValidation.required("{{ .FullyQualifiedName }}", null);
  15. {{- end }}
  16. }
  17. `