DATACMNS-1322 - Add support for Kotlin's copy(…) method.

We now support updating of immutable Kotlin data objects by creating new copies through Kotlin's copy method that is generated along with data classes and immutable properties.

data class DataClassKt(val id: String) {
}

data class ExtendedDataClassKt(val id: String, val name: String) {
}
This commit is contained in:
Mark Paluch
2018-05-22 16:08:49 +02:00
committed by Oliver Gierke
parent 80db17d6ba
commit 79119000bb
8 changed files with 559 additions and 97 deletions

View File

@@ -18,5 +18,5 @@ package org.springframework.data.mapping.context
/**
* @author Mark Paluch
*/
data class SimpleDataClass(val firstname: String) {
}
data class SimpleDataClass(val firstname: String, val lastname: String) {
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright 2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.mapping.model
/**
* @author Mark Paluch
*/
data class DataClassKt(val id: String) {
}
data class ExtendedDataClassKt(val id: String, val name: String) {
}

View File

@@ -0,0 +1,22 @@
/*
* Copyright 2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.mapping.model
/**
* @author Mark Paluch
*/
class ValueClassKt(val immutable: String) {
}