Skip to content

Commit 0e2b1ab

Browse files
authored
minor changes
added some intrnal links, fixed typos and formatting
1 parent 200603d commit 0e2b1ab

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
# enum-mapper
66
The main use: make sure that you always handle all available constants of an enum. An annotation processor will
7-
make sure that you get a compile-time error otherwise.
7+
make sure that you get a compile-time error otherwise: see [Full Enum Mapper](#full-enum-mapper).
8+
You can also use a [Partial Mapper](#partial-enum-mapper) and it supports [Reverse Mapping](#reverse-mapping).
89

910
## Build Configuration
1011

@@ -72,7 +73,7 @@ public class AppUtil {
7273
```
7374
Then the annotation processor will create a full enum-mapper for `ColorEnum` and for `BoolEnum`.
7475

75-
Hint: when you want a map a single enum, you don't need the curly braces (for the array-syntax)
76+
Hint: when you want to map a single enum, you don't need the curly braces (for the array-syntax)
7677
```java
7778
@EnumMappers(ColorEnum.class)
7879
public class AppUtil {
@@ -107,6 +108,7 @@ ExtremeSeasons.getEnumOrNull("Sommer"); // returns the enum-cons
107108
ExtremeSeasons.getEnumOrDefault("Fruehling", FALL)); // returns the enum-constant FALL
108109
ExtremeSeasons.getEnumOrRaise("Fruehling"); // throws an IllegalArgumentException
109110
```
111+
When you do a reverse mapping the mapped values should of course be unique.
110112

111113
### Alternatives
112114
This section mentions some alternative approaches that you can use instead of this annotation processor.
@@ -145,6 +147,7 @@ public enum AlternativeBool {
145147
#### IDE checks
146148
Some IDEs allow you to activate a check that will warn you when you forget an enum constant in a switch statement:
147149
* [Eclipse: Ensuring completeness of switch statements](http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-ensuring_switch_completeness.htm)
150+
148151
**Advantages**
149152
* this approach does not need an annotation processor
150153
* direct and immediate feedback

0 commit comments

Comments
 (0)