Created
July 7, 2018 14:28
-
-
Save fnovoac/2e05d4deede9dd08db557ba98c894750 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DynamicUtil { | |
public static int safeUnbox(java.lang.Integer boxed) { | |
return boxed == null ? 0 : (int)boxed; | |
} | |
public static long safeUnbox(java.lang.Long boxed) { | |
return boxed == null ? 0L : (long)boxed; | |
} | |
public static short safeUnbox(java.lang.Short boxed) { | |
return boxed == null ? 0 : (short)boxed; | |
} | |
public static byte safeUnbox(java.lang.Byte boxed) { | |
return boxed == null ? 0 : (byte)boxed; | |
} | |
public static char safeUnbox(java.lang.Character boxed) { | |
return boxed == null ? '\u0000' : (char)boxed; | |
} | |
public static double safeUnbox(java.lang.Double boxed) { | |
return boxed == null ? 0.0 : (double)boxed; | |
} | |
public static float safeUnbox(java.lang.Float boxed) { | |
return boxed == null ? 0f : (float)boxed; | |
} | |
public static boolean safeUnbox(java.lang.Boolean boxed) { | |
return boxed == null ? false : (boolean)boxed; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment