Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Commit 62e7c72

Browse files
Merge pull request #9 from ThinkingLogic/develop
Develop
2 parents 4ece050 + 82a8900 commit 62e7c72

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ apply plugin: 'kotlin-kapt'
1515
...
1616
dependencies {
1717
...
18-
implementation 'com.thinkinglogic.builder:kotlin-builder-annotation:1.2.0'
19-
kapt 'com.thinkinglogic.builder:kotlin-builder-processor:1.2.0'
18+
implementation 'com.thinkinglogic.builder:kotlin-builder-annotation:1.2.1'
19+
kapt 'com.thinkinglogic.builder:kotlin-builder-processor:1.2.1'
2020
}
2121
```
2222
##### Maven
@@ -26,7 +26,7 @@ dependencies {
2626
<dependency>
2727
<groupId>com.thinkinglogic.builder</groupId>
2828
<artifactId>kotlin-builder-annotation</artifactId>
29-
<version>1.2.0</version>
29+
<version>1.2.1</version>
3030
</dependency>
3131
...
3232
</dependencies>
@@ -46,7 +46,7 @@ dependencies {
4646
<annotationProcessorPath>
4747
<groupId>com.thinkinglogic.builder</groupId>
4848
<artifactId>kotlin-builder-processor</artifactId>
49-
<version>1.2.0</version>
49+
<version>1.2.1</version>
5050
</annotationProcessorPath>
5151
</annotationProcessorPaths>
5252
</configuration>

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ buildscript {
2121

2222
allprojects {
2323
group = 'com.thinkinglogic.builder'
24-
version = '1.2.0'
24+
version = '1.2.1'
2525
apply plugin: "kotlin"
2626

2727
repositories {

kotlin-builder-example-usage/src/main/kotlin/com/thinkinglogic/example/SimpleDataClass.kt

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ data class SimpleDataClass(
1111
val notNullLong: Long,
1212
val nullableLong: Long?,
1313
val date: LocalDate,
14+
val value: String,
1415
@DefaultValue("withDefaultValue") val stringWithDefault: String = "withDefaultValue",
1516
@DefaultValue("LocalDate.MIN") val defaultDate: LocalDate = LocalDate.MIN
1617
) {

kotlin-builder-example-usage/src/test/java/com/thinkinglogic/example/SimpleDataClassJavaTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void toBuilderShouldReturnInitialisedBuilder() {
3232
.notNullString("Foo")
3333
.nullableString("Bar")
3434
.notNullLong(123L)
35+
.value("valueProperty")
3536
.build();
3637

3738
// when

kotlin-builder-example-usage/src/test/kotlin/com/thinkinglogic/example/SimpleDataClassTest.kt

+10-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ internal class SimpleDataClassTest {
1919
nullableString = null,
2020
notNullLong = 123,
2121
nullableLong = 345,
22-
date = LocalDate.now()
22+
date = LocalDate.now(),
23+
value = "valueProperty"
2324
)
2425

2526
// when
@@ -28,6 +29,7 @@ internal class SimpleDataClassTest {
2829
.notNullLong(expected.notNullLong)
2930
.nullableLong(expected.nullableLong)
3031
.date(expected.date)
32+
.value(expected.value)
3133
.stringWithDefault(expected.stringWithDefault)
3234
.defaultDate(expected.defaultDate)
3335
.build()
@@ -44,7 +46,8 @@ internal class SimpleDataClassTest {
4446
nullableString = null,
4547
notNullLong = 123,
4648
nullableLong = 345,
47-
date = LocalDate.now()
49+
date = LocalDate.now(),
50+
value = "valueProperty"
4851
)
4952

5053
// when
@@ -53,6 +56,7 @@ internal class SimpleDataClassTest {
5356
.notNullLong(expected.notNullLong)
5457
.nullableLong(expected.nullableLong)
5558
.date(expected.date)
59+
.value(expected.value)
5660
.build()
5761

5862
// then
@@ -67,7 +71,8 @@ internal class SimpleDataClassTest {
6771
nullableString = null,
6872
notNullLong = 123,
6973
nullableLong = 345,
70-
date = LocalDate.now()
74+
date = LocalDate.now(),
75+
value = "valueProperty"
7176
)
7277

7378
// when
@@ -86,7 +91,8 @@ internal class SimpleDataClassTest {
8691
nullableString = null,
8792
notNullLong = 123,
8893
nullableLong = 345,
89-
date = LocalDate.now()
94+
date = LocalDate.now(),
95+
value = "valueProperty"
9096
)
9197
val newStringValue = "New value"
9298

kotlin-builder-processor/src/main/kotlin/com/thinkinglogic/builder/processor/BuilderProcessor.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class BuilderProcessor : AbstractProcessor() {
216216
return FunSpec.builder(simpleName.toString())
217217
.addParameter(ParameterSpec.builder("value", parameterClass).build())
218218
.returns(builder)
219-
.addCode("return apply·{ $simpleName·=·value }\n")
219+
.addCode("return apply·{ this.$simpleName·=·value }\n")
220220
.build()
221221
}
222222

0 commit comments

Comments
 (0)