FasterXML / FasterXML/jackson-modules-base

Support for default values

Open
#23 11 comments 3 reactions 0 assignees View on GitHub
mrbean
Dominant language
Java
Stars
180
Forks
80
Avg merge
3h 26m
Merged PRs (30d)
1

Description

Besides [this](http://stackoverflow.com/questions/37197174/how-to-specify-default-values-when-using-jackson-with-mr-bean) stackoverflow question, I couldn't really find any information related to this topic but it would be nice to extend the support of default values in Jackson, particularly in the context of the MrBean module.

One option could be using annotations:

```java
interface Person {
@DefaultValue("default first name")
String getFirstName();
@DefaultValue("default last name")
String getLastName();
}
```

Another option could be using Java 8 default methods:

```java
interface Person {
default String getFirstName() { return "default first name"; }
default String getLastName() { return "default last name"; }
}
```

Currently, there are two main limitation I see for MrBean:

1. No possibility to specify default values
2. No possibility to use Java 8 Optional

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.