Example usage for com.google.gson JsonNull INSTANCE

List of usage examples for com.google.gson JsonNull INSTANCE

Introduction

In this page you can find the example usage for com.google.gson JsonNull INSTANCE.

Prototype

JsonNull INSTANCE

To view the source code for com.google.gson JsonNull INSTANCE.

Click Source Link

Document

singleton for JsonNull

Usage

From source file:me.lucko.luckperms.common.utils.gson.JObject.java

License:MIT License

public JObject add(String key, String value) {
    if (value == null) {
        return add(key, JsonNull.INSTANCE);
    }// w  w  w .j  a  v  a  2s.c  o m
    return add(key, new JsonPrimitive(value));
}

From source file:me.lucko.luckperms.common.utils.gson.JObject.java

License:MIT License

public JObject add(String key, Number value) {
    if (value == null) {
        return add(key, JsonNull.INSTANCE);
    }/*from   w  w w . j  a v  a  2 s.c o m*/
    return add(key, new JsonPrimitive(value));
}

From source file:me.lucko.luckperms.common.utils.gson.JObject.java

License:MIT License

public JObject add(String key, Boolean value) {
    if (value == null) {
        return add(key, JsonNull.INSTANCE);
    }/*w w w  . j  av  a 2 s  . c o m*/
    return add(key, new JsonPrimitive(value));
}

From source file:me.lucko.luckperms.common.utils.gson.JObject.java

License:MIT License

public JObject add(String key, JElement value) {
    if (value == null) {
        return add(key, JsonNull.INSTANCE);
    }//from  w w  w. ja  v  a  2  s  . com
    return add(key, value.toJson());
}

From source file:me.trashout.model.serialize.CollectionPointSizeSerializer.java

License:Open Source License

@Override
public JsonElement serialize(Constants.CollectionPointSize src, Type typeOfSrc,
        JsonSerializationContext context) {
    if (src == null)
        return JsonNull.INSTANCE;
    return new JsonPrimitive(src.getName());
}

From source file:me.trashout.model.serialize.CollectionPointTypeSerializer.java

License:Open Source License

@Override
public JsonElement serialize(Constants.CollectionPointType src, Type typeOfSrc,
        JsonSerializationContext context) {
    if (src == null)
        return JsonNull.INSTANCE;
    return new JsonPrimitive(src.getName());
}

From source file:me.trashout.model.serialize.TrashSizeSerializer.java

License:Open Source License

@Override
public JsonElement serialize(Constants.TrashSize src, Type typeOfSrc, JsonSerializationContext context) {
    if (src == null)
        return JsonNull.INSTANCE;
    return new JsonPrimitive(src.getName());
}

From source file:me.trashout.model.serialize.TrashStatusSerializer.java

License:Open Source License

@Override
public JsonElement serialize(Constants.TrashStatus src, Type typeOfSrc, JsonSerializationContext context) {
    if (src == null)
        return JsonNull.INSTANCE;
    return new JsonPrimitive(src.getName());
}

From source file:me.trashout.model.serialize.TrashTypeSerializer.java

License:Open Source License

@Override
public JsonElement serialize(Constants.TrashType src, Type typeOfSrc, JsonSerializationContext context) {
    if (src == null)
        return JsonNull.INSTANCE;
    return new JsonPrimitive(src.getName());
}

From source file:me.trashout.model.serialize.UserActivityTypeSerializer.java

License:Open Source License

@Override
public JsonElement serialize(Constants.UserActivityType src, Type typeOfSrc, JsonSerializationContext context) {
    if (src == null)
        return JsonNull.INSTANCE;
    return new JsonPrimitive(src.getName());
}