Corrected Javadocs to indicate that NumberFormatException gets thrown instead of ClassCastException while attempting to convert a JsonPrimitive to a number.

This commit is contained in:
Inderjeet Singh 2011-03-11 00:14:49 +00:00
parent baf9591d3b
commit 28567508ea

View File

@ -111,7 +111,6 @@ public final class JsonPrimitive extends JsonElement {
* convenience method to get this element as a {@link Boolean}. * convenience method to get this element as a {@link Boolean}.
* *
* @return get this element as a {@link Boolean}. * @return get this element as a {@link Boolean}.
* @throws ClassCastException if the value contained is not a valid boolean value.
*/ */
@Override @Override
Boolean getAsBooleanWrapper() { Boolean getAsBooleanWrapper() {
@ -122,7 +121,6 @@ public final class JsonPrimitive extends JsonElement {
* convenience method to get this element as a boolean value. * convenience method to get this element as a boolean value.
* *
* @return get this element as a primitive boolean value. * @return get this element as a primitive boolean value.
* @throws ClassCastException if the value contained is not a valid boolean value.
*/ */
@Override @Override
public boolean getAsBoolean() { public boolean getAsBoolean() {
@ -142,7 +140,7 @@ public final class JsonPrimitive extends JsonElement {
* convenience method to get this element as a Number. * convenience method to get this element as a Number.
* *
* @return get this element as a Number. * @return get this element as a Number.
* @throws ClassCastException if the value contained is not a valid Number. * @throws NumberFormatException if the value contained is not a valid Number.
*/ */
@Override @Override
public Number getAsNumber() { public Number getAsNumber() {
@ -179,7 +177,6 @@ public final class JsonPrimitive extends JsonElement {
* convenience method to get this element as a String. * convenience method to get this element as a String.
* *
* @return get this element as a String. * @return get this element as a String.
* @throws ClassCastException if the value contained is not a valid String.
*/ */
@Override @Override
public String getAsString() { public String getAsString() {
@ -196,7 +193,7 @@ public final class JsonPrimitive extends JsonElement {
* convenience method to get this element as a primitive double. * convenience method to get this element as a primitive double.
* *
* @return get this element as a primitive double. * @return get this element as a primitive double.
* @throws ClassCastException if the value contained is not a valid double. * @throws NumberFormatException if the value contained is not a valid double.
*/ */
@Override @Override
public double getAsDouble() { public double getAsDouble() {
@ -229,7 +226,7 @@ public final class JsonPrimitive extends JsonElement {
* convenience method to get this element as a float. * convenience method to get this element as a float.
* *
* @return get this element as a float. * @return get this element as a float.
* @throws ClassCastException if the value contained is not a valid float. * @throws NumberFormatException if the value contained is not a valid float.
*/ */
@Override @Override
public float getAsFloat() { public float getAsFloat() {
@ -240,7 +237,7 @@ public final class JsonPrimitive extends JsonElement {
* convenience method to get this element as a primitive long. * convenience method to get this element as a primitive long.
* *
* @return get this element as a primitive long. * @return get this element as a primitive long.
* @throws ClassCastException if the value contained is not a valid long. * @throws NumberFormatException if the value contained is not a valid long.
*/ */
@Override @Override
public long getAsLong() { public long getAsLong() {
@ -251,7 +248,7 @@ public final class JsonPrimitive extends JsonElement {
* convenience method to get this element as a primitive short. * convenience method to get this element as a primitive short.
* *
* @return get this element as a primitive short. * @return get this element as a primitive short.
* @throws ClassCastException if the value contained is not a valid short value. * @throws NumberFormatException if the value contained is not a valid short value.
*/ */
@Override @Override
public short getAsShort() { public short getAsShort() {
@ -262,7 +259,7 @@ public final class JsonPrimitive extends JsonElement {
* convenience method to get this element as a primitive integer. * convenience method to get this element as a primitive integer.
* *
* @return get this element as a primitive integer. * @return get this element as a primitive integer.
* @throws ClassCastException if the value contained is not a valid integer. * @throws NumberFormatException if the value contained is not a valid integer.
*/ */
@Override @Override
public int getAsInt() { public int getAsInt() {