@ -97,12 +97,10 @@ public class GenericMessagingTemplate extends AbstractDestinationResolvingMessag
@@ -97,12 +97,10 @@ public class GenericMessagingTemplate extends AbstractDestinationResolvingMessag
@ -111,18 +109,17 @@ public class GenericMessagingTemplate extends AbstractDestinationResolvingMessag
@@ -111,18 +109,17 @@ public class GenericMessagingTemplate extends AbstractDestinationResolvingMessag
@ -131,11 +128,11 @@ public class GenericMessagingTemplate extends AbstractDestinationResolvingMessag
@@ -131,11 +128,11 @@ public class GenericMessagingTemplate extends AbstractDestinationResolvingMessag
}
/**
*@returntheconfiguredreceiveTimeoutHeader
*Returntheconfiguredreceive-timeoutheader.
*@since5.0
*/
publicStringgetReceiveTimeoutHeader(){
returnreceiveTimeoutHeader;
returnthis.receiveTimeoutHeader;
}
/**
@ -157,6 +154,7 @@ public class GenericMessagingTemplate extends AbstractDestinationResolvingMessag
@@ -157,6 +154,7 @@ public class GenericMessagingTemplate extends AbstractDestinationResolvingMessag
@ -267,6 +265,7 @@ public class GenericMessagingTemplate extends AbstractDestinationResolvingMessag
@@ -267,6 +265,7 @@ public class GenericMessagingTemplate extends AbstractDestinationResolvingMessag
@ -391,9 +391,8 @@ you will be able to write your Kotlin beans without any additional `open` keywor
@@ -391,9 +391,8 @@ you will be able to write your Kotlin beans without any additional `open` keywor
=== Using immutable class instances for persistence
In Kotlin, it is very convenient and considered best practice to declare
read-only properties within the primary constructor, as in the following
example:
In Kotlin, it is very convenient and considered best practice to declare read-only properties
within the primary constructor, as in the following example:
[source,kotlin]
----
@ -401,41 +400,39 @@ class Person(val name: String, val age: Int)
@@ -401,41 +400,39 @@ class Person(val name: String, val age: Int)
----
You can optionally add https://kotlinlang.org/docs/reference/data-classes.html[the `data` keyword]
to make the compiler automatically derives the following members from all properties
declared in the primary constructor:
to make the compiler automatically derive the following members from all properties declared
in the primary constructor:
* equals()/hashCode() pair
* toString() of the form "User(name=John, age=42)"
* componentN() functions corresponding to the properties in their order of declaration
* copy() function
This allows to change easily just one of the properties even if `User` properties are read-only:
his allows us to write:
This allows for easy changes to individual properties even if `Person` properties are read-only:
[source,kotlin]
----
data class Person(val name: String, val age: Int)
val jack = User(name = "Jack", age = 1)
val jack = Person(name = "Jack", age = 1)
val olderJack = jack.copy(age = 2)
----
But some persistence technologies like JPA require a default constructor, preventing this
Common persistence technologies such as JPA require a default constructor, preventing this
kind of design. Fortunately, there is now a workaround for this