Skip to content

Commit

Permalink
fix: added missing string to object mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
JordenReuter committed Jan 8, 2024
1 parent 82ef456 commit 7621263
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public ThemeSnapshotDTOV1 create(Map<String, Theme> data) {

public abstract Map<String, EximThemeDTOV1> map(Map<String, Theme> data);

@Mapping(target = "properties", qualifiedByName = "propertiesJson")
public abstract EximThemeDTOV1 map(Theme theme);

@Mapping(target = "id", ignore = true)
Expand Down Expand Up @@ -81,4 +82,18 @@ public String mapToString(Object properties) {
return null;
}
}

@Named("propertiesJson")
public Object stringToObject(String jsonVar) {

if (jsonVar == null || jsonVar.isEmpty()) {
return null;
}

try {
return objectMapper.readTree(jsonVar);
} catch (JsonProcessingException e) {
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public ThemeInfoListDTO mapInfoList(Stream<ThemeInfo> data) {
public abstract List<ThemeDTO> map(Stream<Theme> entity);

@Mapping(target = "version", source = "modificationCount")
@Mapping(target = "properties", qualifiedByName = "propertiesJson")
public abstract ThemeDTO map(Theme theme);

@Mapping(target = "id", ignore = true)
Expand Down Expand Up @@ -86,4 +87,18 @@ public String mapToString(Object properties) {
}
}

@Named("propertiesJson")
public Object stringToObject(String jsonVar) {

if (jsonVar == null || jsonVar.isEmpty()) {
return null;
}

try {
return mapper.readTree(jsonVar);
} catch (JsonProcessingException e) {
return null;
}
}

}

0 comments on commit 7621263

Please sign in to comment.