From a454f062142ea158f95449203631ea43445d48f6 Mon Sep 17 00:00:00 2001 From: kjg Date: Mon, 16 Mar 2026 23:46:25 +0900 Subject: [PATCH] docs: reorder Quick Start before Installation, add friendly tone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move Quick Start above Installation to match developer reading flow: "what is it?" → "how do I use it?" → "how do I install it?" - Add lighthearted blockquote acknowledging copy-paste is fine (MIT), with a gentle star request --- README.md | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index cbfe918..95a31b5 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,37 @@ public void createUser(NonBlankString name, PositiveInt age, NonEmptyList age = PositiveInt.of(18); +Validation name = NonBlankString.of("Ada"); +Validation> tags = + NonEmptyList.of(Arrays.asList("java", "fp")); // or List.of() on Java 9+ + +// combine results +Validation summary = + name.zip(age, (n, a) -> n.value() + " (" + a.value() + ")"); + +// unsafeOf() throws on invalid input — use at trusted boundaries +PositiveInt confirmedAge = PositiveInt.unsafeOf(18); +``` + ## Installation +> *"I can just implement this myself. Why add a dependency?"* +> +> Totally fair! Copy the source into your project — it's MIT licensed. +> But if it saved you some time... give me a ⭐ 🥺 + Published to [Maven Central](https://central.sonatype.com/artifact/io.github.junggikim/java-refined). Kotlin/JVM users can optionally add `java-refined-kotlin` for extension functions (adds `kotlin-stdlib` dependency). ### Gradle Kotlin DSL @@ -60,30 +89,6 @@ dependencies { ``` -## Quick Start - -```java -import io.github.junggikim.refined.refined.numeric.PositiveInt; -import io.github.junggikim.refined.refined.string.NonBlankString; -import io.github.junggikim.refined.refined.collection.NonEmptyList; -import io.github.junggikim.refined.validation.Validation; -import io.github.junggikim.refined.violation.Violation; -import java.util.Arrays; - -// of() returns Validation — never throws -Validation age = PositiveInt.of(18); -Validation name = NonBlankString.of("Ada"); -Validation> tags = - NonEmptyList.of(Arrays.asList("java", "fp")); // or List.of() on Java 9+ - -// combine results -Validation summary = - name.zip(age, (n, a) -> n.value() + " (" + a.value() + ")"); - -// unsafeOf() throws on invalid input — use at trusted boundaries -PositiveInt confirmedAge = PositiveInt.unsafeOf(18); -``` - ## Kotlin Support Optional module with Kotlin-idiomatic extensions: