Is there any way to cast a null to Integer. The null is actually a String, which i am passing in my service layer that accepts it as an Integer. So, whenever i try to cast a
If you're using apache commons, there is an helper method that does the trick:
NumberUtils.createInteger(myString)
As said in the documentation:
"convert a String to a Integer, handling hex and octal notations; returns null if the string is null; throws NumberFormatException if the value cannot be converted.