23
23
import java .util .Map ;
24
24
25
25
import groovy .text .markup .BaseTemplate ;
26
+ import org .jspecify .annotations .Nullable ;
26
27
27
28
import org .springframework .boot .context .properties .ConfigurationProperties ;
28
29
import org .springframework .core .Ordered ;
@@ -76,7 +77,7 @@ public class GroovyTemplateProperties {
76
77
/**
77
78
* View names that can be resolved.
78
79
*/
79
- private String [] viewNames ;
80
+ private String @ Nullable [] viewNames ;
80
81
81
82
/**
82
83
* Whether to check that the templates location exists.
@@ -141,7 +142,7 @@ public class GroovyTemplateProperties {
141
142
/**
142
143
* String used for auto-indents.
143
144
*/
144
- private String autoIndentString ;
145
+ private @ Nullable String autoIndentString ;
145
146
146
147
/**
147
148
* Whether new lines are rendered automatically.
@@ -156,7 +157,7 @@ public class GroovyTemplateProperties {
156
157
/**
157
158
* Encoding used to write the declaration heading.
158
159
*/
159
- private String declarationEncoding ;
160
+ private @ Nullable String declarationEncoding ;
160
161
161
162
/**
162
163
* Whether elements without a body should be written expanded (<br></br>)
@@ -167,12 +168,12 @@ public class GroovyTemplateProperties {
167
168
/**
168
169
* Default locale for template resolution.
169
170
*/
170
- private Locale locale ;
171
+ private @ Nullable Locale locale ;
171
172
172
173
/**
173
174
* String used to write a new line. Defaults to the system's line separator.
174
175
*/
175
- private String newLineString ;
176
+ private @ Nullable String newLineString ;
176
177
177
178
/**
178
179
* Template path.
@@ -200,11 +201,11 @@ public void setCheckTemplateLocation(boolean checkTemplateLocation) {
200
201
this .checkTemplateLocation = checkTemplateLocation ;
201
202
}
202
203
203
- public String [] getViewNames () {
204
+ public String @ Nullable [] getViewNames () {
204
205
return this .viewNames ;
205
206
}
206
207
207
- public void setViewNames (String [] viewNames ) {
208
+ public void setViewNames (String @ Nullable [] viewNames ) {
208
209
this .viewNames = viewNames ;
209
210
}
210
211
@@ -234,7 +235,7 @@ public Charset getCharset() {
234
235
return this .charset ;
235
236
}
236
237
237
- public String getCharsetName () {
238
+ public @ Nullable String getCharsetName () {
238
239
return (this .charset != null ) ? this .charset .name () : null ;
239
240
}
240
241
@@ -258,11 +259,11 @@ public void setAutoIndent(boolean autoIndent) {
258
259
this .autoIndent = autoIndent ;
259
260
}
260
261
261
- public String getAutoIndentString () {
262
+ public @ Nullable String getAutoIndentString () {
262
263
return this .autoIndentString ;
263
264
}
264
265
265
- public void setAutoIndentString (String autoIndentString ) {
266
+ public void setAutoIndentString (@ Nullable String autoIndentString ) {
266
267
this .autoIndentString = autoIndentString ;
267
268
}
268
269
@@ -282,11 +283,11 @@ public void setBaseTemplateClass(Class<? extends BaseTemplate> baseTemplateClass
282
283
this .baseTemplateClass = baseTemplateClass ;
283
284
}
284
285
285
- public String getDeclarationEncoding () {
286
+ public @ Nullable String getDeclarationEncoding () {
286
287
return this .declarationEncoding ;
287
288
}
288
289
289
- public void setDeclarationEncoding (String declarationEncoding ) {
290
+ public void setDeclarationEncoding (@ Nullable String declarationEncoding ) {
290
291
this .declarationEncoding = declarationEncoding ;
291
292
}
292
293
@@ -298,19 +299,19 @@ public void setExpandEmptyElements(boolean expandEmptyElements) {
298
299
this .expandEmptyElements = expandEmptyElements ;
299
300
}
300
301
301
- public Locale getLocale () {
302
+ public @ Nullable Locale getLocale () {
302
303
return this .locale ;
303
304
}
304
305
305
- public void setLocale (Locale locale ) {
306
+ public void setLocale (@ Nullable Locale locale ) {
306
307
this .locale = locale ;
307
308
}
308
309
309
- public String getNewLineString () {
310
+ public @ Nullable String getNewLineString () {
310
311
return this .newLineString ;
311
312
}
312
313
313
- public void setNewLineString (String newLineString ) {
314
+ public void setNewLineString (@ Nullable String newLineString ) {
314
315
this .newLineString = newLineString ;
315
316
}
316
317
@@ -407,8 +408,9 @@ public void applyToMvcViewResolver(Object viewResolver) {
407
408
resolver .setPrefix (getPrefix ());
408
409
resolver .setSuffix (getSuffix ());
409
410
resolver .setCache (isCache ());
410
- if (getContentType () != null ) {
411
- resolver .setContentType (getContentType ().toString ());
411
+ MimeType contentType = getContentType ();
412
+ if (contentType != null ) {
413
+ resolver .setContentType (contentType .toString ());
412
414
}
413
415
resolver .setViewNames (getViewNames ());
414
416
resolver .setExposeRequestAttributes (isExposeRequestAttributes ());
0 commit comments