net.finmath.smartcontract.valuation.marketdata.data.LocalDateTimeAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of finmath-smart-derivative-contract Show documentation
Show all versions of finmath-smart-derivative-contract Show documentation
Project to support the implementation a of smart derivative contract.
package net.finmath.smartcontract.valuation.marketdata.data;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class LocalDateTimeAdapter extends XmlAdapter {
@Override
public String marshal(LocalDateTime v) {
return v.format(DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss"));
}
@Override
public LocalDateTime unmarshal(String str) throws ParseException {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss");
return LocalDateTime.parse(str, formatter);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy