Class GsonHelper
java.lang.Object
net.minecraft.util.GsonHelper
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimalconvertToBigDecimal(com.google.gson.JsonElement element, String name) static BigIntegerconvertToBigInteger(com.google.gson.JsonElement element, String name) static booleanconvertToBoolean(com.google.gson.JsonElement element, String name) static byteconvertToByte(com.google.gson.JsonElement element, String name) static charconvertToCharacter(com.google.gson.JsonElement element, String name) static doubleconvertToDouble(com.google.gson.JsonElement element, String name) static floatconvertToFloat(com.google.gson.JsonElement element, String name) static intconvertToInt(com.google.gson.JsonElement element, String name) convertToItem(com.google.gson.JsonElement element, String name) static com.google.gson.JsonArrayconvertToJsonArray(com.google.gson.JsonElement element, String name) static com.google.gson.JsonObjectconvertToJsonObject(com.google.gson.JsonElement element, String name) static longconvertToLong(com.google.gson.JsonElement element, String name) static <T> TconvertToObject(@Nullable com.google.gson.JsonElement element, String name, com.google.gson.JsonDeserializationContext context, Class<? extends T> clazz) static shortconvertToShort(com.google.gson.JsonElement element, String name) static StringconvertToString(com.google.gson.JsonElement element, String name) static booleanencodesLongerThan(com.google.gson.JsonElement element, int limit) static <T> Tstatic <T> Tstatic <T> Tstatic <T> @Nullable TfromNullableJson(com.google.gson.Gson gson, Reader reader, com.google.gson.reflect.TypeToken<T> type) static <T> @Nullable TfromNullableJson(com.google.gson.Gson gson, String string, com.google.gson.reflect.TypeToken<T> type) static BigDecimalgetAsBigDecimal(com.google.gson.JsonObject object, String name) static BigDecimalgetAsBigDecimal(com.google.gson.JsonObject object, String name, BigDecimal def) static BigIntegergetAsBigInteger(com.google.gson.JsonObject object, String name) static BigIntegergetAsBigInteger(com.google.gson.JsonObject object, String name, BigInteger def) static booleangetAsBoolean(com.google.gson.JsonObject object, String name) static booleangetAsBoolean(com.google.gson.JsonObject object, String name, boolean def) static bytestatic bytestatic chargetAsCharacter(com.google.gson.JsonObject object, String name) static chargetAsCharacter(com.google.gson.JsonObject object, String name, char def) static doublegetAsDouble(com.google.gson.JsonObject object, String name) static doublegetAsDouble(com.google.gson.JsonObject object, String name, double def) static floatgetAsFloat(com.google.gson.JsonObject object, String name) static floatgetAsFloat(com.google.gson.JsonObject object, String name, float def) static intstatic intstatic com.google.gson.JsonArraygetAsJsonArray(com.google.gson.JsonObject object, String name) static @Nullable com.google.gson.JsonArraygetAsJsonArray(com.google.gson.JsonObject object, String name, @Nullable com.google.gson.JsonArray def) static com.google.gson.JsonObjectgetAsJsonObject(com.google.gson.JsonObject object, String name) static @Nullable com.google.gson.JsonObjectgetAsJsonObject(com.google.gson.JsonObject object, String name, @Nullable com.google.gson.JsonObject def) static longstatic longstatic <T> @Nullable TgetAsObject(com.google.gson.JsonObject object, String name, @Nullable T def, com.google.gson.JsonDeserializationContext context, Class<? extends T> clazz) static <T> TgetAsObject(com.google.gson.JsonObject object, String name, com.google.gson.JsonDeserializationContext context, Class<? extends T> clazz) static shortgetAsShort(com.google.gson.JsonObject object, String name) static shortgetAsShort(com.google.gson.JsonObject object, String name, short def) static StringgetAsString(com.google.gson.JsonObject object, String name) static @Nullable StringgetAsString(com.google.gson.JsonObject object, String name, @Nullable String def) static com.google.gson.JsonElementgetNonNull(com.google.gson.JsonObject object, String name) static StringgetType(@Nullable com.google.gson.JsonElement element) static booleanisArrayNode(com.google.gson.JsonObject node, String name) static booleanisBooleanValue(com.google.gson.JsonElement node) static booleanisBooleanValue(com.google.gson.JsonObject node, String name) static booleanisNumberValue(com.google.gson.JsonElement node) static booleanisNumberValue(com.google.gson.JsonObject node, String name) static booleanisObjectNode(com.google.gson.JsonObject node, String name) static booleanisStringValue(com.google.gson.JsonElement node) static booleanisStringValue(com.google.gson.JsonObject node, String name) static booleanisValidNode(@Nullable com.google.gson.JsonObject node, String name) static booleanisValidPrimitive(com.google.gson.JsonObject node, String name) static com.google.gson.JsonObjectstatic com.google.gson.JsonObjectstatic com.google.gson.JsonArrayparseArray(Reader reader) static com.google.gson.JsonArrayparseArray(String string) private static Collection<Map.Entry<String, com.google.gson.JsonElement>> sortByKeyIfNeeded(Collection<Map.Entry<String, com.google.gson.JsonElement>> elements, @Nullable Comparator<String> keyComparator) static StringtoStableString(com.google.gson.JsonElement jsonElement) static voidwriteValue(com.google.gson.stream.JsonWriter out, @Nullable com.google.gson.JsonElement value, @Nullable Comparator<String> keyComparator)
-
Field Details
-
GSON
private static final com.google.gson.Gson GSON
-
-
Constructor Details
-
GsonHelper
public GsonHelper()
-
-
Method Details
-
isStringValue
-
isStringValue
public static boolean isStringValue(com.google.gson.JsonElement node) -
isNumberValue
-
isNumberValue
public static boolean isNumberValue(com.google.gson.JsonElement node) -
isBooleanValue
-
isBooleanValue
public static boolean isBooleanValue(com.google.gson.JsonElement node) -
isArrayNode
-
isObjectNode
-
isValidPrimitive
-
isValidNode
-
getNonNull
public static com.google.gson.JsonElement getNonNull(com.google.gson.JsonObject object, String name) -
convertToString
-
getAsString
-
getAsString
-
convertToItem
-
getAsItem
-
getAsItem
-
convertToBoolean
-
getAsBoolean
-
getAsBoolean
-
convertToDouble
-
getAsDouble
-
getAsDouble
-
convertToFloat
-
getAsFloat
-
getAsFloat
-
convertToLong
-
getAsLong
-
getAsLong
-
convertToInt
-
getAsInt
-
getAsInt
-
convertToByte
-
getAsByte
-
getAsByte
-
convertToCharacter
-
getAsCharacter
-
getAsCharacter
-
convertToBigDecimal
-
getAsBigDecimal
-
getAsBigDecimal
public static BigDecimal getAsBigDecimal(com.google.gson.JsonObject object, String name, BigDecimal def) -
convertToBigInteger
-
getAsBigInteger
-
getAsBigInteger
public static BigInteger getAsBigInteger(com.google.gson.JsonObject object, String name, BigInteger def) -
convertToShort
-
getAsShort
-
getAsShort
-
convertToJsonObject
public static com.google.gson.JsonObject convertToJsonObject(com.google.gson.JsonElement element, String name) -
getAsJsonObject
public static com.google.gson.JsonObject getAsJsonObject(com.google.gson.JsonObject object, String name) -
getAsJsonObject
@Contract("_,_,!null->!null;_,_,null->_") public static @Nullable com.google.gson.JsonObject getAsJsonObject(com.google.gson.JsonObject object, String name, @Nullable com.google.gson.JsonObject def) -
convertToJsonArray
public static com.google.gson.JsonArray convertToJsonArray(com.google.gson.JsonElement element, String name) -
getAsJsonArray
public static com.google.gson.JsonArray getAsJsonArray(com.google.gson.JsonObject object, String name) -
getAsJsonArray
@Contract("_,_,!null->!null;_,_,null->_") public static @Nullable com.google.gson.JsonArray getAsJsonArray(com.google.gson.JsonObject object, String name, @Nullable com.google.gson.JsonArray def) -
convertToObject
-
getAsObject
-
getAsObject
-
getType
-
fromJson
-
fromNullableJson
public static <T> @Nullable T fromNullableJson(com.google.gson.Gson gson, Reader reader, com.google.gson.reflect.TypeToken<T> type) -
fromJson
public static <T> T fromJson(com.google.gson.Gson gson, Reader reader, com.google.gson.reflect.TypeToken<T> type) -
fromNullableJson
public static <T> @Nullable T fromNullableJson(com.google.gson.Gson gson, String string, com.google.gson.reflect.TypeToken<T> type) -
fromJson
-
parse
-
parse
-
parseArray
-
parseArray
-
toStableString
-
writeValue
public static void writeValue(com.google.gson.stream.JsonWriter out, @Nullable com.google.gson.JsonElement value, @Nullable Comparator<String> keyComparator) throws IOException - Throws:
IOException
-
sortByKeyIfNeeded
private static Collection<Map.Entry<String, com.google.gson.JsonElement>> sortByKeyIfNeeded(Collection<Map.Entry<String, com.google.gson.JsonElement>> elements, @Nullable Comparator<String> keyComparator) -
encodesLongerThan
public static boolean encodesLongerThan(com.google.gson.JsonElement element, int limit)
-