-
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.
- Loading branch information
Showing
36 changed files
with
519 additions
and
353 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
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
29 changes: 29 additions & 0 deletions
29
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,29 @@ | ||
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> | ||
* @implNote Every class that inherits from an initializing class needs to define its own Converter. | ||
* Otherwise, the class is parsed as the super class, and its overrides are not called. | ||
*/ | ||
public interface Initializing { | ||
|
||
void init(); | ||
|
||
class Converter<T extends Initializing> 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
Oops, something went wrong.