@@ -536,7 +536,7 @@ public double optDouble(int index, double defaultValue) {
536536 }
537537
538538 /**
539- * Get the optional double value associated with an index. NaN is returned
539+ * Get the optional float value associated with an index. NaN is returned
540540 * if there is no value for the index, or if the value is not a number and
541541 * cannot be converted to a number.
542542 *
@@ -549,7 +549,7 @@ public float optFloat(int index) {
549549 }
550550
551551 /**
552- * Get the optional double value associated with an index. The defaultValue
552+ * Get the optional float value associated with an index. The defaultValue
553553 * is returned if there is no value for the index, or if the value is not a
554554 * number and cannot be converted to a number.
555555 *
@@ -808,6 +808,22 @@ public long optLong(int index, long defaultValue) {
808808 return defaultValue ;
809809 }
810810
811+ /**
812+ * Get an optional {@link Number} value associated with a key, or <code>null</code>
813+ * if there is no such key or if the value is not a number. If the value is a string,
814+ * an attempt will be made to evaluate it as a number ({@link BigDecimal}). This method
815+ * would be used in cases where type coercion of the number value is unwanted.
816+ *
817+ * @param index
818+ * The index must be between 0 and length() - 1.
819+ * @param defaultValue
820+ * The default.
821+ * @return An object which is the value.
822+ */
823+ public Number optNumber (int index ) {
824+ return this .optNumber (index , null );
825+ }
826+
811827 /**
812828 * Get an optional {@link Number} value associated with a key, or the default if there
813829 * is no such key or if the value is not a number. If the value is a string,
0 commit comments