All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.threetenjaxb.core.MonthXmlAdapter Maven / Gradle / Ivy

The newest version!
package io.github.threetenjaxb.core;

import jakarta.xml.bind.annotation.adapters.XmlAdapter;

import java.time.Month;

/**
 * {@code XmlAdapter} mapping JSR-310 {@code Month} to ISO proleptic month number
 * 

* Month number interpretation details: *

    *
  • {@link java.time.Month#of(int)}
  • *
  • {@link java.time.Month#getValue()}
  • *
*

* Be aware that using this adapter will yield {@code null} when unmarshalling * {@code xsd:gMonth} types. Use {@link MonthAsTextXmlAdapter} instead. * * @see jakarta.xml.bind.annotation.adapters.XmlAdapter * @see java.time.Month */ public class MonthXmlAdapter extends XmlAdapter { @Override public Month unmarshal(Integer intValue) { return intValue != null ? Month.of(intValue) : null; } @Override public Integer marshal(Month value) { return value != null ? value.getValue() : null; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy