-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add meta model, return rebalance conditions
Signed-off-by: Michael Edgar <[email protected]>
- Loading branch information
Showing
8 changed files
with
162 additions
and
57 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
44 changes: 44 additions & 0 deletions
44
api/src/main/java/com/github/streamshub/console/api/model/JsonApiMeta.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,44 @@ | ||
package com.github.streamshub.console.api.model; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
import org.eclipse.microprofile.openapi.annotations.media.Schema; | ||
|
||
import com.fasterxml.jackson.annotation.JsonAnyGetter; | ||
import com.fasterxml.jackson.annotation.JsonAnySetter; | ||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
|
||
@Schema(additionalProperties = Object.class) | ||
public class JsonApiMeta { | ||
|
||
public static JsonApiMeta put(JsonApiMeta meta, String key, Object value) { | ||
if (meta == null) { | ||
meta = new JsonApiMeta(); | ||
} | ||
meta.put(key, value); | ||
return meta; | ||
} | ||
|
||
@JsonIgnore | ||
private Map<String, Object> meta; | ||
|
||
@JsonAnyGetter | ||
public Map<String, Object> get() { | ||
return meta; | ||
} | ||
|
||
public Object get(String key) { | ||
return meta != null ? meta.get(key) : null; | ||
} | ||
|
||
@JsonAnySetter | ||
public JsonApiMeta put(String key, Object value) { | ||
if (meta == null) { | ||
meta = new LinkedHashMap<>(); | ||
} | ||
meta.put(key, value); | ||
return this; | ||
} | ||
|
||
} |
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.