Skip to content

Commit

Permalink
upgrade dependencies
Browse files Browse the repository at this point in the history
add CharValue and CharValueFactory to values4k
  • Loading branch information
daviddenton committed Feb 3, 2024
1 parent 505cd9b commit 76c73c2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
This list is not intended to be all-encompassing - it will document major and breaking API changes with their rationale
when appropriate:

### v2.12.3.0
- **all** : Upgrade of dependencies
- **values4k** : Add CharValueFactory

### v2.12.2.0
- **data4k** : Add missing node types

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 4 additions & 0 deletions values4k/src/main/kotlin/dev/forkhandles/values/factories.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ open class Base16StringValueFactory<DOMAIN : Value<String>>(
showFn: (String) -> String = { it },
) : ValueFactory<DOMAIN, String>(fn, rfcBase16Alphabet::matches.and(validation), parseFn, showFn)

open class CharValueFactory<DOMAIN : Value<Char>>(
fn: (Char) -> DOMAIN, validation: Validation<Char>? = null
) : ValueFactory<DOMAIN, Char>(fn, validation, String::first)

open class IntValueFactory<DOMAIN : Value<Int>>(
fn: (Int) -> DOMAIN, validation: Validation<Int>? = null
) : ValueFactory<DOMAIN, Int>(fn, validation, String::toInt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import java.time.ZonedDateTime
import java.util.UUID

typealias StringValue = AbstractValue<String>
typealias CharValue = AbstractValue<Char>
typealias IntValue = AbstractValue<Int>
typealias LongValue = AbstractValue<Long>
typealias DoubleValue = AbstractValue<Double>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.natpryce.hamkrest.equalTo
import org.junit.jupiter.api.Test
import java.math.BigDecimal
import java.math.BigInteger
import java.net.URL
import java.net.URI
import java.time.Clock
import java.time.Duration
import java.time.Instant
Expand Down Expand Up @@ -45,8 +45,10 @@ class FactoriesTest {
"hello".also { assertThat(NonBlankStringValueFactory(::TV).parse(it), equalTo(TV(it))) }
" ".also { assertThat(NonBlankStringValueFactory(::TV).parseOrNull(it), absent()) }

'c'.also { assertThat(CharValueFactory(::TV).parse(it.toString()), equalTo(TV(it))) }

UUID.randomUUID().also { assertThat(UUIDValueFactory(::TV).parse(it.toString()), equalTo(TV(it))) }
URL("http://localhost").also { assertThat(URLValueFactory(::TV).parse(it.toString()), equalTo(TV(it))) }
URI("http://localhost").toURL().also { assertThat(URLValueFactory(::TV).parse(it.toString()), equalTo(TV(it))) }

Duration.ofHours(1).also { assertThat(DurationValueFactory(::TV).parse(it.toString()), equalTo(TV(it))) }
Instant.now().also { assertThat(InstantValueFactory(::TV).parse(it.toString()), equalTo(TV(it))) }
Expand Down
6 changes: 0 additions & 6 deletions versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,4 @@ version.kotlinx.serialization=1.6.2

version.strikt=0.34.1

## unused
version.org.openjdk.jmh..jmh-generator-bytecode=1.36

## unused
version.org.openjdk.jmh..jmh-core=1.36

version.org.kt3k.gradle.plugin..coveralls-gradle-plugin=2.8.3

0 comments on commit 76c73c2

Please sign in to comment.