+ * A helper method for safely using the value of an optional attribute that
+ * may be null if not present in the XML. Answers the boolean value, or false
+ * if null.
+ *
+ * @param b
+ * @return
+ */
+ public static boolean safeBoolean(Boolean b)
+ {
+ return b == null ? false : b.booleanValue();
+ }
+
+ /**
+ * A helper method for safely using the value of an optional attribute that
+ * may be null if not present in the XML. Answers the integer value, or zero
+ * if null.
+ *
+ * @param i
+ * @return
+ */
+ public static int safeInt(Integer i)
+ {
+ return i == null ? 0 : i.intValue();
+ }
+
+ /**
+ * A helper method for safely using the value of an optional attribute that
+ * may be null if not present in the XML. Answers the float value, or zero if
+ * null.
+ *
+ * @param f
+ * @return
+ */
+ public static float safeFloat(Float f)
+ {
+ return f == null ? 0f : f.floatValue();
+ }
+
+ /**