org.docx4j.wml.BigIntegerAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docx4j Show documentation
Show all versions of docx4j Show documentation
docx4j is a library which helps you to work with the Office Open
XML file format as used in docx
documents, pptx presentations, and xlsx spreadsheets.
package org.docx4j.wml;
import java.math.BigInteger;
import javax.xml.bind.annotation.adapters.XmlAdapter;
public class BigIntegerAdapter extends XmlAdapter {
@Override
public String marshal(BigInteger bigDecimal) throws Exception {
if (bigDecimal != null){
return bigDecimal.toString();
}
else {
return null;
}
}
@Override
public BigInteger unmarshal(String s) throws Exception {
try {
return new BigInteger(s);
} catch (NumberFormatException e) {
return null;
}
}
}