How can I configure mapstruct mapper to check for empty not only for null when converting String to Long.
if ( entityOld.getNumber() != null ) {
entityNew.setNumber( Long.parseLong( entityOld.getNumber() ) );
}
the exception that I get is:
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[na:1.8.0_131]
at java.lang.Long.parseLong(Long.java:601) ~[na:1.8.0_131]
So basically if a string is empty I want that the to be considered as having the value "0".