Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Dec 12, 2024
1 parent 8674ee2 commit 875a270
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@ internal inline val Project.runtimeConfiguration: Configuration
internal inline fun <reified V : Any, reified P : Provider<V>> ObjectFactory.property(
defaultValue: Any? = null,
): P {
val valueClass = V::class.java
return when (P::class.java) {
ListProperty::class.java -> listProperty(V::class.java).apply {
ListProperty::class.java -> listProperty(valueClass).apply {
if (defaultValue != null) convention(defaultValue as List<V>)
}
SetProperty::class.java -> setProperty(V::class.java).apply {
SetProperty::class.java -> setProperty(valueClass).apply {
if (defaultValue != null) convention(defaultValue as Set<V>)
}
MapProperty::class.java -> mapProperty(String::class.java, V::class.java).apply {
MapProperty::class.java -> mapProperty(String::class.java, valueClass).apply {
if (defaultValue != null) convention(defaultValue as Map<String, V>)
}
else -> property(V::class.java).apply {
else -> property(valueClass).apply {
if (defaultValue != null) convention(defaultValue as V)
}
} as P
Expand Down

0 comments on commit 875a270

Please sign in to comment.