-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3499 from ingef/feature/integrate-object-initiali…
…zation-upon-parsing Feature/integrate object initialization upon parsing
- Loading branch information
Showing
34 changed files
with
444 additions
and
281 deletions.
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/com/bakdata/conquery/io/jackson/Initializing.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,27 @@ | ||
package com.bakdata.conquery.io.jackson; | ||
|
||
import com.fasterxml.jackson.databind.util.StdConverter; | ||
|
||
/** | ||
* Interface for class instances that need initialization after deserialization and value injection. | ||
* Let the class implement this interface and annotate the class with: | ||
* <pre> | ||
* {@code | ||
* @JsonDeserialize(converter = Initializing.Converter.class ) | ||
* } | ||
* </pre> | ||
* @param <T> | ||
*/ | ||
public interface Initializing<T extends Initializing<T>> { | ||
|
||
T init(); | ||
|
||
class Converter<T extends Initializing<T>> extends StdConverter<T, T> { | ||
|
||
@Override | ||
public T convert(T value) { | ||
value.init(); | ||
return value; | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.