Class for deserialization added as argument
This commit is contained in:
parent
b7cbcb82b1
commit
7f4139d14a
|
@ -125,16 +125,16 @@ public class ServiceCatalogueConfiguration extends CatalogueConfiguration {
|
|||
return mapper.writeValueAsString(objectNode);
|
||||
}
|
||||
|
||||
public static ServiceCatalogueConfiguration getServiceCatalogueConfiguration(String json) throws Exception {
|
||||
public static <C extends CatalogueConfiguration> C getServiceCatalogueConfiguration(String json, Class<C> clz) throws Exception {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
ServiceCatalogueConfiguration catalogueConfiguration = mapper.readValue(json, ServiceCatalogueConfiguration.class);
|
||||
return catalogueConfiguration;
|
||||
C c = mapper.readValue(json, clz);
|
||||
return c;
|
||||
}
|
||||
|
||||
public static ServiceCatalogueConfiguration getServiceCatalogueConfiguration(ObjectNode objectNode) throws Exception {
|
||||
public static <C extends CatalogueConfiguration> C getServiceCatalogueConfiguration(ObjectNode objectNode, Class<C> clz) throws Exception {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
ServiceCatalogueConfiguration catalogueConfiguration = mapper.treeToValue(objectNode, ServiceCatalogueConfiguration.class);
|
||||
return catalogueConfiguration;
|
||||
C c = mapper.treeToValue(objectNode, clz);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue