Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make Jackson's JsonSerializable work like meta-annotation to generate
jackson compatible code #112
- Loading branch information
Showing
3 changed files
with
75 additions
and
22 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
value-fixture/src/org/immutables/fixture/jackson/MetaJacksonAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.immutables.fixture.jackson; | ||
|
||
import org.immutables.value.Value; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Retention; | ||
|
||
@JsonSerialize | ||
@Retention(RetentionPolicy.CLASS) | ||
public @interface MetaJacksonAnnotation {} | ||
|
||
@MetaJacksonAnnotation | ||
@Value.Immutable | ||
interface Val { | ||
// compile check for presense of | ||
// the Jackson specific creator method | ||
// triggered by meta annotation | ||
default void use() { | ||
ImmutableVal.fromAllAttributes(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters