-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathmodel.java.tmpl
More file actions
81 lines (70 loc) · 2.66 KB
/
Copy pathmodel.java.tmpl
File metadata and controls
81 lines (70 loc) · 2.66 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package com.databricks.sdk.service.{{.Package.Name}};
import java.util.Map;
import java.io.InputStream;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collection;
import java.util.Objects;
import com.databricks.sdk.support.Generated;
import com.databricks.sdk.support.QueryParam;
import com.databricks.sdk.support.ToStringer;
{{if .IsExternal}}
There is a small issue with the code generator causing this class to be generated twice. This should be fixed upstream
in the code generator, after which this block can be removed. For now, we skip generating the model for all external
types.
{{skipThisFile}}
{{end}}
{{if .Description}}/**
{{.Comment " * " 80}}
*/{{end}}
{{if .Fields -}}
@Generated
public class {{.PascalName}} {
{{- range .Fields}}
/**
{{.Comment " * " 80}}
*/
{{if .IsJson}}@JsonProperty("{{.Name}}"){{end}}{{if .IsQuery}}@QueryParam("{{.Name}}"){{end}}
private {{template "type" .Entity }} {{.CamelName}}{{if .IsNameReserved}}Value{{end}};
{{end}}
{{- range .Fields}}
public {{template "type" .Of}} set{{.PascalName}}({{template "type" .Entity }} {{.CamelName}}{{if .IsNameReserved}}Value{{end}}) {
this.{{.CamelName}}{{if .IsNameReserved}}Value{{end}} = {{.CamelName}}{{if .IsNameReserved}}Value{{end}};
return this;
}
public {{template "type" .Entity }} get{{.PascalName}}() {
return {{.CamelName}}{{if .IsNameReserved}}Value{{end}};
}
{{end}}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
{{.PascalName}} that = ({{.PascalName}}) o;
return {{range $i, $x := .Fields}}{{if $i}}&& {{end}}Objects.equals({{.CamelName}}{{if .IsNameReserved}}Value{{end}}, that.{{.CamelName}}{{if .IsNameReserved}}Value{{end}})
{{end}};
}
@Override
public int hashCode() {
return Objects.hash({{range $i, $x := .Fields}}{{if $i}}, {{end}}{{.CamelName}}{{if .IsNameReserved}}Value{{end}}{{end}});
}
@Override
public String toString() {
return new ToStringer({{.PascalName}}.class){{range .Fields}}
.add("{{.CamelName}}{{if .IsNameReserved}}Value{{end}}", {{.CamelName}}{{if .IsNameReserved}}Value{{end}})
{{- end}}.toString();
}
}
{{else if .Enum -}}
@Generated
public enum {{.PascalName}}{
{{range .Enum -}}
{{ if not (eq .Content .ConstantName) }}
@JsonProperty("{{.Content}}") {{end}}{{.ConstantName}},{{.Comment "// " 80}}
{{ end }}
}
{{ else }}
Any types that have no fields (i.e. primitives or array types) or are not enums are not represented by distinct Java
types in the Java SDK.
{{skipThisFile}}
{{- end}}