forked from bufbuild/protoc-gen-validate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
msg.go
33 lines (30 loc) · 801 Bytes
/
msg.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package java
const msgTpl = `
/**
* Validates {@code {{ simpleName . }}} protobuf objects.
*/
public static class {{ simpleName . }}Validator implements io.envoyproxy.pgv.ValidatorImpl<{{ qualifiedName . }}> {
{{- template "msgInner" . -}}
}
`
const msgInnerTpl = `
{{- range .NonOneOfFields }}
{{ renderConstants (context .) }}
{{ end }}
{{ range .OneOfs }}
{{ template "oneOfConst" . }}
{{ end }}
public void assertValid({{ qualifiedName . }} proto, io.envoyproxy.pgv.ValidatorIndex index) throws io.envoyproxy.pgv.ValidationException {
{{ if disabled . }}
// Validate is disabled for {{ simpleName . }}
return;
{{- else -}}
{{ range .NonOneOfFields -}}
{{ render (context .) }}
{{ end -}}
{{ range .OneOfs }}
{{ template "oneOf" . }}
{{- end -}}
{{- end }}
}
`