Skip to content

Commit

Permalink
Polish naming for Charset setters in FreeMarker support
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Jun 26, 2024
1 parent 0811296 commit 95887c8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ public void setDefaultEncoding(String defaultEncoding) {
}

/**
* Set the default encoding for the FreeMarker {@link Configuration}, which
* is used to decode byte sequences to character sequences when reading template
* files.
* Set the {@link Charset} for the default encoding for the FreeMarker
* {@link Configuration}, which is used to decode byte sequences to character
* sequences when reading template files.
* <p>See {@link #setDefaultEncoding(String)} for details.
* @since 6.2
* @see java.nio.charset.StandardCharsets
*/
public void setDefaultEncoding(Charset defaultEncoding) {
setDefaultEncoding(defaultEncoding.name());
public void setDefaultCharset(Charset defaultCharset) {
this.defaultEncoding = defaultCharset.name();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class FreeMarkerConfigurer extends FreeMarkerConfigurationFactory


public FreeMarkerConfigurer() {
setDefaultEncoding(StandardCharsets.UTF_8);
setDefaultCharset(StandardCharsets.UTF_8);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,22 +167,22 @@ protected Configuration obtainConfiguration() {
* process. See the note in the {@linkplain FreeMarkerView class-level
* documentation} for details.
* @see freemarker.template.Configuration#setDefaultEncoding
* @see #setEncoding(Charset)
* @see #setCharset(Charset)
* @see #getEncoding()
*/
public void setEncoding(@Nullable String encoding) {
this.encoding = encoding;
}

/**
* Set the encoding used to decode byte sequences to character sequences when
* reading the FreeMarker template file for this view.
* Set the {@link Charset} used to decode byte sequences to character sequences
* when reading the FreeMarker template file for this view.
* <p>See {@link #setEncoding(String)} for details.
* @since 6.2
* @see java.nio.charset.StandardCharsets
*/
public void setEncoding(@Nullable Charset encoding) {
setEncoding(encoding != null ? encoding.name() : null);
public void setCharset(@Nullable Charset charset) {
this.encoding = (charset != null ? charset.name() : null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void configureViewResolvers(ViewResolverRegistry registry) {
public FreeMarkerConfigurer freeMarkerConfigurer() {
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setPreTemplateLoaders(classTemplateLoader);
configurer.setDefaultEncoding(UTF_8);
configurer.setDefaultCharset(UTF_8);
return configurer;
}
}
Expand All @@ -158,7 +158,7 @@ public void configureViewResolvers(ViewResolverRegistry registry) {
public FreeMarkerConfigurer freeMarkerConfigurer() {
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setPreTemplateLoaders(classTemplateLoader);
configurer.setDefaultEncoding(ISO_8859_1);
configurer.setDefaultCharset(ISO_8859_1);
return configurer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public class FreeMarkerView extends AbstractTemplateView {
* process. See the note in the {@linkplain FreeMarkerView class-level
* documentation} for details.
* @see freemarker.template.Configuration#setDefaultEncoding
* @see #setEncoding(Charset)
* @see #setCharset(Charset)
* @see #getEncoding()
* @see #setContentType(String)
*/
Expand All @@ -125,14 +125,14 @@ public void setEncoding(@Nullable String encoding) {
}

/**
* Set the encoding used to decode byte sequences to character sequences when
* reading the FreeMarker template file for this view.
* Set the {@link Charset} used to decode byte sequences to character sequences
* when reading the FreeMarker template file for this view.
* <p>See {@link #setEncoding(String)} for details.
* @since 6.2
* @see java.nio.charset.StandardCharsets
*/
public void setEncoding(@Nullable Charset encoding) {
setEncoding(encoding != null ? encoding.name() : null);
public void setCharset(@Nullable Charset charset) {
this.encoding = (charset != null ? charset.name() : null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void configureViewResolvers(ViewResolverRegistry registry) {
public FreeMarkerConfigurer freeMarkerConfigurer() {
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setTemplateLoaderPath("/WEB-INF/");
configurer.setDefaultEncoding(UTF_8);
configurer.setDefaultCharset(UTF_8);
return configurer;
}
}
Expand All @@ -183,7 +183,7 @@ public FreeMarkerViewResolver freeMarkerViewResolver() {
public FreeMarkerConfigurer freeMarkerConfigurer() {
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setTemplateLoaderPath("/WEB-INF/");
configurer.setDefaultEncoding(UTF_8);
configurer.setDefaultCharset(UTF_8);
return configurer;
}
}
Expand Down

0 comments on commit 95887c8

Please sign in to comment.