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:org.restcomm.connect.http.converter.GeolocationConverter.java

License:Open Source License

protected void writeCause(final String cause, final JsonObject object) {
    if (cause != null) {
        object.addProperty("cause", cause);
    } else {//from ww  w  .  j  ava  2s . c om
        object.add("cause", JsonNull.INSTANCE);
    }
}

From source file:org.restcomm.connect.http.converter.IncomingPhoneNumberConverter.java

License:Open Source License

private void writeUssdApplicationSid(final Sid ussdApplicationSid, final JsonObject object) {
    if (ussdApplicationSid != null) {
        object.addProperty("ussd_application_sid", ussdApplicationSid.toString());
    } else {/*  w ww  .ja va 2 s. c o m*/
        object.add("ussd_application_sid", JsonNull.INSTANCE);
    }
}

From source file:org.restcomm.connect.http.converter.IncomingPhoneNumberConverter.java

License:Open Source License

private void writeReferApplicationSid(final Sid referApplicationSid, final JsonObject object) {
    if (referApplicationSid != null) {
        object.addProperty("refer_application_sid", referApplicationSid.toString());
    } else {//from  www .  ja  va2 s.c o  m
        object.add("refer_application_sid", JsonNull.INSTANCE);
    }
}

From source file:org.restcomm.connect.http.converter.IncomingPhoneNumberConverter.java

License:Open Source License

private void writeVoiceApplicationName(final String voiceApplicationName, final JsonObject object) {
    if (voiceApplicationName != null)
        object.addProperty("voice_application_name", voiceApplicationName);
    else/*from ww  w  . j  a va2s. c  o m*/
        object.add("voice_application_name", JsonNull.INSTANCE);
}

From source file:org.restcomm.connect.http.converter.IncomingPhoneNumberConverter.java

License:Open Source License

private void writeSmsApplicationName(final String smsApplicationName, final JsonObject object) {
    if (smsApplicationName != null)
        object.addProperty("sms_application_name", smsApplicationName);
    else//from w w  w .  ja v  a  2  s.  c  o m
        object.add("sms_application_name", JsonNull.INSTANCE);
}

From source file:org.restcomm.connect.http.converter.IncomingPhoneNumberConverter.java

License:Open Source License

private void writeUssdApplicationName(final String ussdApplicationName, final JsonObject object) {
    if (ussdApplicationName != null)
        object.addProperty("ussd_application_name", ussdApplicationName);
    else//  ww  w .  ja va2  s  . c om
        object.add("ussd_application_name", JsonNull.INSTANCE);
}

From source file:org.restcomm.connect.http.converter.IncomingPhoneNumberConverter.java

License:Open Source License

private void writeReferApplicationName(final String referApplicationName, final JsonObject object) {
    if (referApplicationName != null)
        object.addProperty("refer_application_name", referApplicationName);
    else//from   w w w .j a  va  2s .  c o m
        object.add("refer_application_name", JsonNull.INSTANCE);
}

From source file:org.sourcepit.common.json.GsonBuilderDelegate.java

License:Apache License

@Override
public void setNull(JsonObject owner, String name) {
    owner.add(name, JsonNull.INSTANCE);
}

From source file:org.sourcepit.common.json.GsonBuilderDelegate.java

License:Apache License

@Override
public void addNull(JsonArray array) {
    array.add(JsonNull.INSTANCE);
}

From source file:org.sourcepit.docker.watcher.State.java

License:Apache License

private static JsonObject createEvent(final String oldStatus, JsonObject oldDetail, final String newStatus,
        JsonObject newDetail) {//w ww  .  jav a 2  s.c o m
    JsonObject event = new JsonObject();
    if (oldStatus == null) {
        event.add("OldState", JsonNull.INSTANCE);
    } else {
        event.addProperty("OldState", oldStatus);
    }
    if (newStatus == null) {
        event.add("NewState", JsonNull.INSTANCE);
    } else {
        event.addProperty("NewState", newStatus);
    }
    event.add("OldDetail", oldDetail == null ? JsonNull.INSTANCE : oldDetail);
    event.add("NewDetail", newDetail == null ? JsonNull.INSTANCE : newDetail);
    return event;
}