Package dev.javatools.map
Class CreateMap
java.lang.Object
dev.javatools.map.CreateMap
public class CreateMap
extends java.lang.Object
Use this for creating a Map from Json String or from models or from json String stored in a file.
-
Constructor Summary
Constructors Constructor Description CreateMap() -
Method Summary
Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.Object>create(java.io.File input)Convert json string that is in the file into a Map.java.util.Map<java.lang.String,java.lang.Object>create(java.lang.Object input)Convert any custom object into a Map.java.util.Map<java.lang.String,java.lang.Object>create(java.lang.String input)Create a Map from json String
-
Constructor Details
-
CreateMap
public CreateMap()
-
-
Method Details
-
create
public java.util.Map<java.lang.String,java.lang.Object> create(java.io.File input) throws java.io.IOExceptionConvert json string that is in the file into a Map.- Parameters:
input- , file containing the json String.- Returns:
- returns Map representation of the File content
- Throws:
java.io.IOException- Throws IOException, if the provided Json is not valid or if the file does not exists.
-
create
public java.util.Map<java.lang.String,java.lang.Object> create(java.lang.String input) throws com.fasterxml.jackson.core.JsonProcessingExceptionCreate a Map from json String- Parameters:
input- Json String- Returns:
- returns Map representation of the File content
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- Throws JsonProcessingException, if the provided Json is not valid
-
create
public java.util.Map<java.lang.String,java.lang.Object> create(java.lang.Object input) throws com.fasterxml.jackson.core.JsonProcessingExceptionConvert any custom object into a Map.- Parameters:
input- And custome model object that you want to convert to Map- Returns:
- returns Map representation of the File content
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- Throws JsonProcessingException, if the provided Object is not valid model
-