Package net.minecraft.util
Class GsonHelper
java.lang.Object
net.minecraft.util.GsonHelper
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimal
convertToBigDecimal
(com.google.gson.JsonElement p_144779_, String p_144780_) static BigInteger
convertToBigInteger
(com.google.gson.JsonElement p_144782_, String p_144783_) static boolean
convertToBoolean
(com.google.gson.JsonElement p_13878_, String p_13879_) static byte
convertToByte
(com.google.gson.JsonElement p_13904_, String p_13905_) static char
convertToCharacter
(com.google.gson.JsonElement p_144776_, String p_144777_) static double
convertToDouble
(com.google.gson.JsonElement p_144770_, String p_144771_) static float
convertToFloat
(com.google.gson.JsonElement p_13889_, String p_13890_) static int
convertToInt
(com.google.gson.JsonElement p_13898_, String p_13899_) static Item
convertToItem
(com.google.gson.JsonElement p_13875_, String p_13876_) static com.google.gson.JsonArray
convertToJsonArray
(com.google.gson.JsonElement p_13925_, String p_13926_) static com.google.gson.JsonObject
convertToJsonObject
(com.google.gson.JsonElement p_13919_, String p_13920_) static long
convertToLong
(com.google.gson.JsonElement p_13892_, String p_13893_) static <T> T
convertToObject
(com.google.gson.JsonElement p_13809_, String p_13810_, com.google.gson.JsonDeserializationContext p_13811_, Class<? extends T> p_13812_) static short
convertToShort
(com.google.gson.JsonElement p_144788_, String p_144789_) static String
convertToString
(com.google.gson.JsonElement p_13806_, String p_13807_) static <T> T
fromJson
(com.google.gson.Gson p_13768_, Reader p_13769_, com.google.gson.reflect.TypeToken<T> p_13770_) static <T> T
fromJson
(com.google.gson.Gson p_263499_, Reader p_263527_, com.google.gson.reflect.TypeToken<T> p_263525_, boolean p_263507_) static <T> T
static <T> T
static <T> T
static <T> T
static <T> T
fromNullableJson
(com.google.gson.Gson p_13772_, Reader p_13773_, com.google.gson.reflect.TypeToken<T> p_13774_, boolean p_13775_) static <T> T
fromNullableJson
(com.google.gson.Gson p_13781_, Reader p_13782_, Class<T> p_13783_, boolean p_13784_) static <T> T
fromNullableJson
(com.google.gson.Gson p_13786_, String p_13787_, com.google.gson.reflect.TypeToken<T> p_13788_) static <T> T
fromNullableJson
(com.google.gson.Gson p_13790_, String p_13791_, com.google.gson.reflect.TypeToken<T> p_13792_, boolean p_13793_) static <T> T
fromNullableJson
(com.google.gson.Gson p_13799_, String p_13800_, Class<T> p_13801_, boolean p_13802_) static BigDecimal
getAsBigDecimal
(com.google.gson.JsonObject p_144797_, String p_144798_) static BigDecimal
getAsBigDecimal
(com.google.gson.JsonObject p_144751_, String p_144752_, BigDecimal p_144753_) static BigInteger
getAsBigInteger
(com.google.gson.JsonObject p_144800_, String p_144801_) static BigInteger
getAsBigInteger
(com.google.gson.JsonObject p_144755_, String p_144756_, BigInteger p_144757_) static boolean
getAsBoolean
(com.google.gson.JsonObject p_13913_, String p_13914_) static boolean
getAsBoolean
(com.google.gson.JsonObject p_13856_, String p_13857_, boolean p_13858_) static byte
static byte
static char
getAsCharacter
(com.google.gson.JsonObject p_144794_, String p_144795_) static char
getAsCharacter
(com.google.gson.JsonObject p_144739_, String p_144740_, char p_144741_) static double
getAsDouble
(com.google.gson.JsonObject p_144785_, String p_144786_) static double
getAsDouble
(com.google.gson.JsonObject p_144743_, String p_144744_, double p_144745_) static float
getAsFloat
(com.google.gson.JsonObject p_13916_, String p_13917_) static float
getAsFloat
(com.google.gson.JsonObject p_13821_, String p_13822_, float p_13823_) static int
static int
static Item
static Item
static com.google.gson.JsonArray
getAsJsonArray
(com.google.gson.JsonObject p_13934_, String p_13935_) static com.google.gson.JsonArray
getAsJsonArray
(com.google.gson.JsonObject p_13833_, String p_13834_, com.google.gson.JsonArray p_13835_) static com.google.gson.JsonObject
getAsJsonObject
(com.google.gson.JsonObject p_13931_, String p_13932_) static com.google.gson.JsonObject
getAsJsonObject
(com.google.gson.JsonObject p_13842_, String p_13843_, com.google.gson.JsonObject p_13844_) static long
static long
static <T> T
getAsObject
(com.google.gson.JsonObject p_13837_, String p_13838_, com.google.gson.JsonDeserializationContext p_13839_, Class<? extends T> p_13840_) static <T> T
getAsObject
(com.google.gson.JsonObject p_13846_, String p_13847_, T p_13848_, com.google.gson.JsonDeserializationContext p_13849_, Class<? extends T> p_13850_) static short
getAsShort
(com.google.gson.JsonObject p_144803_, String p_144804_) static short
getAsShort
(com.google.gson.JsonObject p_144759_, String p_144760_, short p_144761_) static String
getAsString
(com.google.gson.JsonObject p_13907_, String p_13908_) static String
getAsString
(com.google.gson.JsonObject p_13852_, String p_13853_, String p_13854_) static com.google.gson.JsonElement
getNonNull
(com.google.gson.JsonObject p_289782_, String p_289789_) static String
getType
(com.google.gson.JsonElement p_13884_) static boolean
isArrayNode
(com.google.gson.JsonObject p_13886_, String p_13887_) static boolean
isBooleanValue
(com.google.gson.JsonElement p_144768_) static boolean
isBooleanValue
(com.google.gson.JsonObject p_13881_, String p_13882_) static boolean
isNumberValue
(com.google.gson.JsonElement p_13873_) static boolean
isNumberValue
(com.google.gson.JsonObject p_144763_, String p_144764_) static boolean
isObjectNode
(com.google.gson.JsonObject p_144773_, String p_144774_) static boolean
isStringValue
(com.google.gson.JsonElement p_13804_) static boolean
isStringValue
(com.google.gson.JsonObject p_13814_, String p_13815_) static boolean
isValidNode
(com.google.gson.JsonObject p_13901_, String p_13902_) static boolean
isValidPrimitive
(com.google.gson.JsonObject p_13895_, String p_13896_) static com.google.gson.JsonObject
static com.google.gson.JsonObject
static com.google.gson.JsonObject
static com.google.gson.JsonObject
static com.google.gson.JsonArray
parseArray
(Reader p_144766_) static com.google.gson.JsonArray
parseArray
(String p_216215_) private static Collection<Map.Entry<String,
com.google.gson.JsonElement>> sortByKeyIfNeeded
(Collection<Map.Entry<String, com.google.gson.JsonElement>> p_216212_, Comparator<String> p_216213_) static String
toStableString
(com.google.gson.JsonElement p_216217_) static void
writeValue
(com.google.gson.stream.JsonWriter p_216208_, com.google.gson.JsonElement p_216209_, Comparator<String> p_216210_)
-
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 p_13804_) -
isNumberValue
-
isNumberValue
public static boolean isNumberValue(com.google.gson.JsonElement p_13873_) -
isBooleanValue
-
isBooleanValue
public static boolean isBooleanValue(com.google.gson.JsonElement p_144768_) -
isArrayNode
-
isObjectNode
-
isValidPrimitive
-
isValidNode
-
getNonNull
public static com.google.gson.JsonElement getNonNull(com.google.gson.JsonObject p_289782_, String p_289789_) -
convertToString
-
getAsString
-
getAsString
-
convertToItem
-
getAsItem
-
getAsItem
-
convertToBoolean
-
getAsBoolean
-
getAsBoolean
public static boolean getAsBoolean(com.google.gson.JsonObject p_13856_, String p_13857_, boolean p_13858_) -
convertToDouble
-
getAsDouble
-
getAsDouble
public static double getAsDouble(com.google.gson.JsonObject p_144743_, String p_144744_, double p_144745_) -
convertToFloat
-
getAsFloat
-
getAsFloat
public static float getAsFloat(com.google.gson.JsonObject p_13821_, String p_13822_, float p_13823_) -
convertToLong
-
getAsLong
-
getAsLong
-
convertToInt
-
getAsInt
-
getAsInt
-
convertToByte
-
getAsByte
-
getAsByte
-
convertToCharacter
-
getAsCharacter
-
getAsCharacter
public static char getAsCharacter(com.google.gson.JsonObject p_144739_, String p_144740_, char p_144741_) -
convertToBigDecimal
public static BigDecimal convertToBigDecimal(com.google.gson.JsonElement p_144779_, String p_144780_) -
getAsBigDecimal
-
getAsBigDecimal
public static BigDecimal getAsBigDecimal(com.google.gson.JsonObject p_144751_, String p_144752_, BigDecimal p_144753_) -
convertToBigInteger
public static BigInteger convertToBigInteger(com.google.gson.JsonElement p_144782_, String p_144783_) -
getAsBigInteger
-
getAsBigInteger
public static BigInteger getAsBigInteger(com.google.gson.JsonObject p_144755_, String p_144756_, BigInteger p_144757_) -
convertToShort
-
getAsShort
-
getAsShort
public static short getAsShort(com.google.gson.JsonObject p_144759_, String p_144760_, short p_144761_) -
convertToJsonObject
public static com.google.gson.JsonObject convertToJsonObject(com.google.gson.JsonElement p_13919_, String p_13920_) -
getAsJsonObject
public static com.google.gson.JsonObject getAsJsonObject(com.google.gson.JsonObject p_13931_, String p_13932_) -
getAsJsonObject
@Nullable @Contract("_,_,!null->!null;_,_,null->_") public static com.google.gson.JsonObject getAsJsonObject(com.google.gson.JsonObject p_13842_, String p_13843_, @Nullable com.google.gson.JsonObject p_13844_) -
convertToJsonArray
public static com.google.gson.JsonArray convertToJsonArray(com.google.gson.JsonElement p_13925_, String p_13926_) -
getAsJsonArray
public static com.google.gson.JsonArray getAsJsonArray(com.google.gson.JsonObject p_13934_, String p_13935_) -
getAsJsonArray
@Nullable @Contract("_,_,!null->!null;_,_,null->_") public static com.google.gson.JsonArray getAsJsonArray(com.google.gson.JsonObject p_13833_, String p_13834_, @Nullable com.google.gson.JsonArray p_13835_) -
convertToObject
-
getAsObject
-
getAsObject
-
getType
-
fromNullableJson
-
fromJson
-
fromNullableJson
@Nullable public static <T> T fromNullableJson(com.google.gson.Gson p_13772_, Reader p_13773_, com.google.gson.reflect.TypeToken<T> p_13774_, boolean p_13775_) -
fromJson
public static <T> T fromJson(com.google.gson.Gson p_263499_, Reader p_263527_, com.google.gson.reflect.TypeToken<T> p_263525_, boolean p_263507_) -
fromNullableJson
@Nullable public static <T> T fromNullableJson(com.google.gson.Gson p_13790_, String p_13791_, com.google.gson.reflect.TypeToken<T> p_13792_, boolean p_13793_) -
fromJson
-
fromNullableJson
-
fromJson
public static <T> T fromJson(com.google.gson.Gson p_13768_, Reader p_13769_, com.google.gson.reflect.TypeToken<T> p_13770_) -
fromNullableJson
@Nullable public static <T> T fromNullableJson(com.google.gson.Gson p_13786_, String p_13787_, com.google.gson.reflect.TypeToken<T> p_13788_) -
fromJson
-
fromJson
-
parse
-
parse
-
parse
-
parse
-
parseArray
-
parseArray
-
toStableString
-
writeValue
public static void writeValue(com.google.gson.stream.JsonWriter p_216208_, @Nullable com.google.gson.JsonElement p_216209_, @Nullable Comparator<String> p_216210_) throws IOException - Throws:
IOException
-
sortByKeyIfNeeded
private static Collection<Map.Entry<String,com.google.gson.JsonElement>> sortByKeyIfNeeded(Collection<Map.Entry<String, com.google.gson.JsonElement>> p_216212_, @Nullable Comparator<String> p_216213_)
-