Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 8th, 2020 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package parsers;
  2.  
  3. import com.fasterxml.jackson.databind.ObjectMapper;
  4. import test.User;
  5.  
  6. import java.io.File;
  7. import java.io.IOException;
  8.  
  9. public class jsonMarshaller implements Marshaller<User> {
  10.  
  11.     @Override
  12.     public User read(File file) {
  13.         ObjectMapper mapper = new ObjectMapper();
  14.  
  15.         User user = null;
  16.         try {
  17.             user = mapper.readValue(file, User.class);
  18.         } catch (IOException e) {
  19.             e.printStackTrace();
  20.         }
  21.         return user;
  22.     }
  23.  
  24.     @Override
  25.     public File write(User user) {
  26.         ObjectMapper mapper = new ObjectMapper();
  27.         String path = "src/main/resources/";
  28.         String name = "userJackson.json";
  29.         File file = new File(path + name);
  30.         try {
  31.             mapper.writeValue(file, user);
  32.         } catch (IOException e) {
  33.             e.printStackTrace();
  34.         }
  35.         return file;
  36.     }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top