@@ -77,51 +77,29 @@ public int getValue() {
77
77
78
78
}
79
79
80
- private HarmCategory category ;
80
+ private final HarmCategory category ;
81
81
82
- private HarmBlockThreshold threshold ;
82
+ private final HarmBlockThreshold threshold ;
83
83
84
- private HarmBlockMethod method ;
84
+ private final HarmBlockMethod method ;
85
85
86
- // Default constructor
87
- public VertexAiGeminiSafetySetting () {
88
- this .category = HarmCategory .HARM_CATEGORY_UNSPECIFIED ;
89
- this .threshold = HarmBlockThreshold .HARM_BLOCK_THRESHOLD_UNSPECIFIED ;
90
- this .method = HarmBlockMethod .HARM_BLOCK_METHOD_UNSPECIFIED ;
91
- }
92
86
93
- // Constructor with all fields
94
- public VertexAiGeminiSafetySetting (HarmCategory category , HarmBlockThreshold threshold , HarmBlockMethod method ) {
95
- this .category = category ;
96
- this .threshold = threshold ;
97
- this .method = method ;
87
+ private VertexAiGeminiSafetySetting (Builder builder ) {
88
+ this .category = builder .category ;
89
+ this .threshold = builder .threshold ;
90
+ this .method = builder .method ;
98
91
}
99
92
100
- // Getters and setters
101
93
public HarmCategory getCategory () {
102
94
return this .category ;
103
95
}
104
-
105
- public void setCategory (HarmCategory category ) {
106
- this .category = category ;
107
- }
108
-
109
96
public HarmBlockThreshold getThreshold () {
110
97
return this .threshold ;
111
98
}
112
-
113
- public void setThreshold (HarmBlockThreshold threshold ) {
114
- this .threshold = threshold ;
115
- }
116
-
117
99
public HarmBlockMethod getMethod () {
118
100
return this .method ;
119
101
}
120
102
121
- public void setMethod (HarmBlockMethod method ) {
122
- this .method = method ;
123
- }
124
-
125
103
@ Override
126
104
public String toString () {
127
105
return "SafetySetting{" + "category=" + this .category + ", threshold=" + this .threshold + ", method="
@@ -180,7 +158,7 @@ public Builder withMethod(HarmBlockMethod method) {
180
158
}
181
159
182
160
public VertexAiGeminiSafetySetting build () {
183
- return new VertexAiGeminiSafetySetting (this . category , this . threshold , this . method );
161
+ return new VertexAiGeminiSafetySetting (this );
184
162
}
185
163
186
164
}
0 commit comments