Skip to content

Commit 788649e

Browse files
committed
Update README.md
1 parent 2baa2cf commit 788649e

File tree

1 file changed

+60
-30
lines changed

1 file changed

+60
-30
lines changed

README.md

Lines changed: 60 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Problem4J Core
22

3-
[![JitPack](https://jitpack.io/v/malczuuu/problem4j-core.svg)](https://jitpack.io/#malczuuu/problem4j-core)
4-
[![Build Status](https://github.com/malczuuu/problem4j-core/actions/workflows/gradle.yml/badge.svg)](https://github.com/malczuuu/problem4j-core/actions/workflows/gradle.yml)
5-
[![Weekly Build Status](https://github.com/malczuuu/problem4j-core/actions/workflows/gradle-weekly.yml/badge.svg)](https://github.com/malczuuu/problem4j-core/actions/workflows/gradle-weekly.yml)
3+
[![Build Status](https://github.com/malczuuu/problem4j-core/actions/workflows/gradle-build.yml/badge.svg)](https://github.com/malczuuu/problem4j-core/actions/workflows/gradle-build.yml)
64

75
> Part of [`problem4j`][problem4j] package of libraries.
86
@@ -12,6 +10,13 @@ an immutable `Problem` class and a fluent `ProblemBuilder` for convenient constr
1210
It is intended to be used as a **foundation** for other libraries or applications that add framework-specific behavior
1311
(e.g. Jackson, Spring).
1412

13+
## Table of Contents
14+
15+
- [Features](#features)
16+
- [Example](#example)
17+
- [Usage](#usage)
18+
- [Problem4J Links](#problem4j-links)
19+
1520
## Features
1621

1722
- ✅ Immutable `Problem` data model
@@ -30,39 +35,64 @@ It is intended to be used as a **foundation** for other libraries or application
3035
## Example
3136

3237
```java
33-
Problem problem =
34-
Problem.builder()
35-
.type("https://example.com/errors/invalid-request")
36-
.title("Invalid Request")
37-
.status(400)
38-
.detail("not a valid json")
39-
.instance("https://example.com/instances/1234")
40-
.build();
41-
42-
throw new ProblemException(problem);
38+
import io.github.malczuuu.problem4j.core.Problem;
39+
import io.github.malczuuu.problem4j.core.ProblemException;
40+
41+
public class ExampleClass {
42+
43+
public void method() {
44+
Problem problem =
45+
Problem.builder()
46+
.type("https://example.com/errors/invalid-request")
47+
.title("Invalid Request")
48+
.status(400)
49+
.detail("not a valid json")
50+
.instance("https://example.com/instances/1234")
51+
.build();
52+
53+
throw new ProblemException(problem);
54+
}
55+
}
4356
```
4457

4558
## Usage
4659

47-
This library is available through [Jitpack][jitpack] repository. Add it along with repository in your dependency
48-
manager.
60+
Add library as dependency to Maven or Gradle. See the actual versions on [Maven Central][maven-central]. **Java 8** or
61+
higher is required to use this library.
62+
63+
1. Maven:
64+
```xml
65+
<dependencies>
66+
<dependency>
67+
<groupId>io.github.malczuuu.problem4j</groupId>
68+
<artifactId>problem4j-core</artifactId>
69+
<version>${problem4j-core.version}</version>
70+
</dependency>
71+
</dependencies>
72+
```
73+
2. Gradle (Groovy or Kotlin DSL):
74+
```groovy
75+
dependencies {
76+
implementation("io.github.malczuuu.problem4j:problem4j-core:${problem4j-core.version}")
77+
}
78+
```
79+
80+
## Problem4J Links
81+
82+
- [`problem4j`][problem4j] - Documentation repository.
83+
- [`problem4j-core`][problem4j-core] - Core library defining `Problem` model and `ProblemException`.
84+
- [`problem4j-jackson`][problem4j-jackson] - Jackson module for serializing and deserializing `Problem` objects.
85+
- [`problem4j-spring-web`][problem4j-spring-web] - Spring Web module extending `ResponseEntityExceptionHandler` for
86+
handling exceptions and returning `Problem` responses.
87+
88+
[maven-central]: https://central.sonatype.com/artifact/io.github.malczuuu.problem4j/problem4j-core
4989
50-
```groovy
51-
// build.gradle
90+
[problem4j]: https://github.com/malczuuu/problem4j
5291
53-
repositories {
54-
// ...
55-
maven { url = uri("https://jitpack.io") }
56-
}
92+
[problem4j-core]: https://github.com/malczuuu/problem4j-core
5793
58-
dependencies {
59-
// ...
60-
implementation("com.github.malczuuu:problem4j-core:<version>")
61-
}
62-
```
94+
[problem4j-jackson]: https://github.com/malczuuu/problem4j-jackson
6395
64-
[rfc7807]: https://datatracker.ietf.org/doc/html/rfc7807
96+
[problem4j-spring-web]: https://github.com/malczuuu/problem4j-spring-web
6597
66-
[problem4j]: https://github.com/malczuuu/problem4j
67-
68-
[jitpack]: https://jitpack.io/#malczuuu/problem4j-core
98+
[rfc7807]: https://datatracker.ietf.org/doc/html/rfc7807

0 commit comments

Comments
 (0)