11---
2- sidebar_position : 2
2+ sidebar_position : 1
33---
44
5- # Problem4J Core
5+ # Setting Up & Configuration
66
7- Problem4J Core provides a framework-agnostic set of features to be used in implementing framework-specific features by
8- other modules. There are two primary ways of throwing exception with ` Problem ` .
9-
10- 1 . Throw a ` ProblemException ` .
11- 2 . Throw exception annotated with ` @ProblemMapping ` .
12-
13- Following chapters touch also other aspects, such as ` ProblemContext ` and how to approach altering ` Problem ` objects,
14- if they are immutable.
7+ Setting up dependencies for using Problem4J Core library.
158
169## Dependency
1710
@@ -35,7 +28,18 @@ higher is required to use this library.
3528 }
3629 ```
3730
38- ## Throw a `ProblemException `
31+ ## Usage
32+
33+ Problem4J Core provides a framework- agnostic set of features to be used in implementing framework- specific features by
34+ other modules. There are two primary ways of throwing exception with `Problem `.
35+
36+ 1 . Throw a `ProblemException `.
37+ 2 . Throw exception annotated with `@ProblemMapping`.
38+
39+ Following chapters touch also other aspects, such as `ProblemContext ` and how to approach altering `Problem ` objects,
40+ if they are immutable.
41+
42+ ### Throw a `ProblemException `
3943
4044The most basic method is to throw a `ProblemException ` or its subclass.
4145
@@ -83,7 +87,7 @@ static Problem Problem.of(URI type, String title, int status);
8387static Problem Problem . of(URI type, String title, int status, @Nullable String detail);
8488```
8589
86- ## Throw exception annotated with ` @ProblemMapping `
90+ ### Throw exception annotated with ` @ProblemMapping `
8791
8892If an exception is annotated with ` @ProblemMapping ` , extracting the underlying ` Problem ` from it requires a bit of
8993setup first. Fields such as ` type ` , ` title ` , ` detail ` and ` instance ` allow to interpolate fields from exception object
@@ -137,7 +141,7 @@ try {
137141}
138142```
139143
140- ## Including ` ProblemContext ` in ` @ProblemMapping ` -annotated exception
144+ ### Including ` ProblemContext ` in ` @ProblemMapping ` -annotated exception
141145
142146` ProblemMapper ` allows passing ` ProblemContext ` instance as an additional argument to ` toProblemBuilder ` method. Such
143147context allows to pass additional data for ` @ProblemMapping ` fields interpolation.
@@ -184,7 +188,7 @@ try {
184188}
185189```
186190
187- ## Modifying ` Problem ` objects
191+ ### Modifying ` Problem ` objects
188192
189193` Problem ` objects are immutable. In order to change any of its values, you are required to create a new ` Problem `
190194object. For that purpose, consider using ` toBuilder() ` method.
0 commit comments