Skip to content

Commit 97117ba

Browse files
committed
feat(apix): query read inherited properties
1 parent 903195d commit 97117ba

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

lib/src/main/kotlin/com/openmeteo/apix/common/http/Endpoint.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import java.net.URL
1010
import javax.net.ssl.HttpsURLConnection
1111

1212
abstract class Endpoint(
13+
@Transient
1314
val context: URL,
1415
) : Http<InputStream>, Query {
1516

lib/src/main/kotlin/com/openmeteo/apix/common/query/Query.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import kotlinx.serialization.*
44
import java.net.URL
55
import kotlin.reflect.KClass
66
import kotlin.reflect.KProperty1
7-
import kotlin.reflect.full.declaredMemberProperties
8-
import kotlin.reflect.full.findAnnotation
9-
import kotlin.reflect.full.hasAnnotation
10-
import kotlin.reflect.full.superclasses
7+
import kotlin.reflect.full.*
118

129
interface Query {
1310

@@ -38,8 +35,8 @@ interface Query {
3835
private fun value(property: KProperty1<Query, *>) =
3936
property.get(this)?.let { Companion.value(it) }
4037

41-
private val nonTransientDeclaredMemberProperties get() =
42-
javaClass.kotlin.declaredMemberProperties
38+
private val memberProperties get() =
39+
javaClass.kotlin.memberProperties
4340
.filter { !it.hasAnnotation<Transient>() }
4441

4542
/**
@@ -48,7 +45,7 @@ interface Query {
4845
* Please note that pairs with null values are filtered out.
4946
*/
5047
fun toList () =
51-
nonTransientDeclaredMemberProperties
48+
memberProperties
5249
.mapNotNull { value(it)?.let { v -> key(it, javaClass.kotlin) to v } }
5350

5451
fun toMap() =

0 commit comments

Comments
 (0)