nikeza

Untitled

Mar 28th, 2020
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1.  
  2.  @XmlJavaTypeAdapter(LocalDateTimeAdapter.class)
  3.  
  4.  ---------------------
  5.  
  6. public class LocalDateTimeAdapter extends XmlAdapter<String, LocalDateTime> {
  7.     @Override
  8.     public LocalDateTime unmarshal(String s) throws Exception {
  9.         return LocalDateTime.parse(s, DateTimeFormatter.ofPattern("yyyy/MM/dd' 'HH:mm:ss"));
  10.     }
  11.  
  12.     @Override
  13.     public String marshal(LocalDateTime localDateTime) throws Exception {
  14.         return localDateTime.toString();
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment