Permalink
Browse files

Deprecate JsonElement.getAsCharacter

  • Loading branch information...
NightlyNexus authored and JakeWharton committed Jul 30, 2018
1 parent d8d8ccb commit 92b617379191bec5bc498830c87b0c143975848c
Showing with 7 additions and 3 deletions.
  1. +7 −3 gson/src/main/java/com/google/gson/JsonElement.java
@@ -259,15 +259,19 @@ public byte getAsByte() {
}
/**
* convenience method to get this element as a primitive character value.
* convenience method to get the first character of this element as a string or the first
* character of this array's first element as a string.
*
* @return get this element as a primitive char value.
* @return the first character of the string.
* @throws ClassCastException if the element is of not a {@link JsonPrimitive} and is not a valid
* char value.
* string value.
* @throws IllegalStateException if the element is of the type {@link JsonArray} but contains
* more than a single element.
* @since 1.3
* @deprecated This method is misleading, as it does not get this element as a char but rather as
* a string's first character.
*/
@Deprecated
public char getAsCharacter() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}

0 comments on commit 92b6173

Please sign in to comment.