mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-08 16:19:48 +00:00
Fix Kotlin examples in the reference manual
This commit fixes the following issues in the reference manual. - Remove the dangling opening brace from the Kotlin `PlaceOfBirth` example in example-classes.adoc. - Use `JsonView::class.java.name` instead of `JsonView::class.qualifiedName` in the Kotlin examples in jackson.adoc, since `qualifiedName` is nullable whereas `Model#set()` does not accept a null key. - Remove unnecessary semicolons after the empty interface bodies in the Java examples in jackson.adoc. Closes gh-37101 Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
This commit is contained in:
@@ -145,7 +145,7 @@ Kotlin::
|
||||
----
|
||||
package org.spring.samples.spel.inventor
|
||||
|
||||
class PlaceOfBirth(var city: String, var country: String? = null) {
|
||||
class PlaceOfBirth(var city: String, var country: String? = null)
|
||||
----
|
||||
======
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ Java::
|
||||
|
||||
public class User {
|
||||
|
||||
public interface WithoutPasswordView {};
|
||||
public interface WithPasswordView extends WithoutPasswordView {};
|
||||
public interface WithoutPasswordView {}
|
||||
public interface WithPasswordView extends WithoutPasswordView {}
|
||||
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
+3
-3
@@ -31,8 +31,8 @@ Java::
|
||||
|
||||
public class User {
|
||||
|
||||
public interface WithoutPasswordView {};
|
||||
public interface WithPasswordView extends WithoutPasswordView {};
|
||||
public interface WithoutPasswordView {}
|
||||
public interface WithPasswordView extends WithoutPasswordView {}
|
||||
|
||||
private String username;
|
||||
private String password;
|
||||
@@ -152,7 +152,7 @@ Kotlin::
|
||||
@GetMapping("/user")
|
||||
fun getUser(model: Model): String {
|
||||
model["user"] = User("eric", "7!jd#h23")
|
||||
model[JsonView::class.qualifiedName] = User.WithoutPasswordView::class.java
|
||||
model[JsonView::class.java.name] = User.WithoutPasswordView::class.java
|
||||
return "userView"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user