File: file.go

package info (click to toggle)
golang-github-envoyproxy-protoc-gen-validate 1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,720 kB
  • sloc: java: 1,768; python: 1,203; xml: 893; cpp: 414; makefile: 154; sh: 9
file content (45 lines) | stat: -rw-r--r-- 1,256 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
45
package java

const fileTpl = `// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: {{ .File.InputPath }}

package {{ javaPackage .File }};

{{ if isOfFileType . }}
@SuppressWarnings("all")
public class {{ classNameFile . }}Validator {
	public static io.envoyproxy.pgv.ValidatorImpl validatorFor(Class clazz) {
		{{ range .AllMessages }}
		{{ if not (ignored .) -}}
		if (clazz.equals({{ qualifiedName . }}.class)) return new {{ simpleName .}}Validator();
		{{- end }}
		{{- end }}
		return null;
	}

{{ range .AllMessages -}}
	{{- template "msg" . -}}
{{- end }}
}
{{ else }}
/**
* Validates {@code {{ simpleName . }}} protobuf objects.
*/
@SuppressWarnings("all")
public class {{ classNameMessage .}}Validator implements io.envoyproxy.pgv.ValidatorImpl<{{ qualifiedName . }}>{
	public static io.envoyproxy.pgv.ValidatorImpl validatorFor(Class clazz) {
		if (clazz.equals({{ qualifiedName . }}.class)) return new {{ simpleName .}}Validator();
		{{ range .AllMessages }}
		{{ if not (ignored .) -}}
		if (clazz.equals({{ qualifiedName . }}.class)) return new {{ simpleName .}}Validator();
		{{- end }}
		{{- end }}
		return null;
	}
	{{- template "msgInner" . -}}
	{{ range .AllMessages -}}
	{{- template "msg" . -}}
	{{- end }}
}
{{ end }}
`