Interface Jsonable

All Known Implementing Classes:
Account, AccountResponseException, Action, AdvancedInsightResponse, AdvancedMachineDetection, AnswerWebhook, AppEndpoint, AppEndpoint, Application, Application, Application.Capabilities, Application.Keys, Application.Privacy, ApplicationList, ApplicationResponseException, Archive, AudioEarmuffOffEvent, AudioEarmuffOnEvent, AudioMuteOffEvent, AudioMuteOnEvent, AudioPlayDoneEvent, AudioPlayEvent, AudioPlayStopEvent, AudioRecordEvent, AudioRecordStopEvent, AudioSayDoneEvent, AudioSayEvent, AudioSayStopEvent, AvailableFeatures, AvailableNumber, BackendAuthResponse, BalanceResponse, BaseConversation, BaseMember, BaseUser, BasicInsightResponse, Broadcast, BroadcastUrls, Button, Call, Callback, Callback.Params, CallbackUrls, CallerIdentity, CallEvent, CallEvent, CallInfo, CallInfoPage, CamaraResponseException, Capability, CaptionsRequest, CaptionsResponse, CarrierDetails, Channel, Channels, CheckResponse, ConnectAction, ConnectRequest, ConnectResponse, ContactsList, Content, Context, ControlResponse, Conversation, ConversationAction, ConversationProperties, ConversationsResponseException, ConversationTimestamp, ConversationUpdatedEvent, Country, CreateSessionResponse, CreateSubaccountRequest, CustomEvent, Datasource, DialInNumber, DtmfResponse, DtmfResult, DtmfSettings, EmailWorkflow, EmbeddedCalls, EphemeralEvent, Event, Event, EventDeleteEvent, EventWebhook, FraudCheckResponse, FraudScore, GenericEvent, GetStreamResponse, HalLinks, HalPageResponse, Hls, InboundMessage, InboundMessage.Origin, InboundMessage.UrlWrapper, InboundMessage.UrlWrapperWithCaption, InboundMessage.Whatsapp, InitialJoinOptions, InputAction, InputEvent, JsonableBaseObject, ListAttribute, ListConversationsResponse, ListEventsResponse, ListItem, ListItemsResponse, ListListsResponse, ListMembersResponse, ListNumbersResponse, ListSecretsResponse, ListSubaccountsResponse, ListTemplateFragmentsResponse, ListTemplatesResponse, ListUserConversationsResponse, ListUsersResponse, Location, Location, LogoUploadsUrlResponse, LogoUploadsUrlResponse.Fields, ManualDatasource, MediaAudioSettings, MeetingRoom, MeetingsEventCallback, MeetingsResponseException, Member, MemberChannel, MemberInitiator, MemberMedia, MemberTimestamp, MessageDeliveredEvent, MessageEvent, MessageEvent, MessageEvent, MessagePayload, MessageRejectedEvent, MessageRequest, MessageResponse, MessageResponseException, Messages, MessageSeenEvent, MessageStatus, MessageStatus.Error, MessageStatus.Usage, MessageSubmittedEvent, MessageUndeliverableEvent, Messenger, Messenger, MessengerAudioRequest, MessengerFileRequest, MessengerImageRequest, MessengerRequest, MessengerTextRequest, MessengerVideoRequest, Mms, MmsAudioRequest, MmsImageRequest, MmsRequest, MmsVcardRequest, MmsVideoRequest, MoneyTransfer, Ncco, Network, NetworkApis, NetworkAuthResponseException, NotifyAction, NotifyEvent, NumberInsight2ResponseException, NumbersResponseException, NumberTransfer, Order, OutboundSettings, OwnedNumber, PageLink, PageLinks, Phone, PhoneEndpoint, PhoneEndpoint, PrefixPricingResponse, PricingResponse, ProactiveConnectResponseException, ProductItem, Profile, ProjectDetails, Pstn, RcsCustomRequest, RcsFileRequest, RcsImageRequest, RcsRequest, RcsTextRequest, RcsVideoRequest, Reaction, RealTimeData, RecordAction, RecordEvent, Recording, RecordingOptions, RedactRequest, RedactResponseException, Referral, ReferredProduct, RenderRequest, RenderRequest.Properties, RenderResponse, Reply, RoamingDetails, RoomLinks, Rtc, Rtmp, SalesforceDatasource, SearchNumbersResponse, SearchVerifyResponse, SecretResponse, SessionStream, SettingsResponse, SignalRequest, SilentAuthWorkflow, SimSwap, Sip, SipDialRequest, SipDialResponse, SipEndpoint, SipEndpoint, Sms, SmsInboundMetadata, SmsSubmissionResponse, SmsSubmissionResponseMessage, SmsTextRequest, SmsWorkflow, SpeechResults, SpeechSettings, SpeechTranscript, StandardInsightResponse, Sticker, StreamAction, StreamComposition, StreamCompositionLayout, StreamResponse, SubaccountsResponseException, SyncStatus, TalkAction, TalkPayload, TalkResponse, Template, Template, TemplateFragment, Theme, TokenResponse, TranscriptionSettings, UISettings, UpdateApplicationRequest, UpdateMemberRequest, UpdateRoomRequest, UpdateSubaccountRequest, UploadListItemsResponse, UrlContainer, User, UserConversation, UsersResponseException, Vbc, Vbc, VbcEndpoint, VbcEndpoint, VerificationCallback, VerificationRequest, VerificationResponse, Verify, VerifyCheck, VerifyCodeResponse, VerifyDetails, VerifyResponse, VerifyResponseException, Viber, ViberFileRequest, ViberImageRequest, ViberRequest, ViberService, ViberTextRequest, ViberVideoRequest, Video, VideoResponseException, VideoStream, Voice, VoiceResponseException, VoiceWorkflow, VonageApiResponseException, Webhook, Websocket, Websocket, WebSocketEndpoint, WebSocketEndpoint, Whatsapp, Whatsapp, WhatsappAudioRequest, WhatsappCodelessWorkflow, WhatsappCustomRequest, WhatsappFileRequest, WhatsappImageRequest, WhatsappLocationRequest, WhatsappMultiProductRequest, WhatsappReactionRequest, WhatsappRequest, WhatsappSingleProductRequest, WhatsappStickerRequest, WhatsappTemplateRequest, WhatsappTextRequest, WhatsappVideoRequest, WhatsappVoice, WhatsappWorkflow, Workflow, WorkflowStatus

public interface Jsonable
Indicates that a class can be serialized to and parsed from JSON.
Since:
7.7.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.fasterxml.jackson.databind.ObjectMapper
    Convenience method for creating an ObjectMapper with standard settings.
    static <J extends Jsonable>
    J
    fromJson(String json, J... type)
    Delegates to fromJson(String, Class), using the type varargs for inferring the class.
    static <J extends Jsonable>
    J
    fromJson(String json, Class<? extends J> jsonable)
    Creates a new instance of the designated Jsonable class, calling its no-args constructor followed by updateFromJson(String).
    default String
    Serialises this class to a JSON payload.
    default void
    Updates this class's fields from the JSON payload.
  • Method Details

    • createDefaultObjectMapper

      static com.fasterxml.jackson.databind.ObjectMapper createDefaultObjectMapper()
      Convenience method for creating an ObjectMapper with standard settings.
      Returns:
      A new ObjectMapper with appropriate configuration.
    • toJson

      default String toJson()
      Serialises this class to a JSON payload.
      Returns:
      The JSON string representing this class's marked properties.
    • updateFromJson

      default void updateFromJson(String json)
      Updates this class's fields from the JSON payload.
      Parameters:
      json - The JSON string.
      Throws:
      VonageResponseParseException - If the JSON was invalid or this class couldn't be updated.
    • fromJson

      static <J extends Jsonable> J fromJson(String json, J... type)
      Delegates to fromJson(String, Class), using the type varargs for inferring the class.
      Type Parameters:
      J - A class which implements this interface.
      Parameters:
      json - The JSON string to parse.
      type - Unused. This is a hack to get the array class's component type.
      Returns:
      A new instance of the inferred Jsonable.
      Throws:
      VonageUnexpectedException - If a no-args constructor for the class was not found.
      VonageResponseParseException - If the JSON was invalid or this class couldn't be updated.
    • fromJson

      static <J extends Jsonable> J fromJson(String json, Class<? extends J> jsonable)
      Creates a new instance of the designated Jsonable class, calling its no-args constructor followed by updateFromJson(String).
      Type Parameters:
      J - A class which implements this interface.
      Parameters:
      json - The JSON string to parse.
      jsonable - The Jsonable class to construct.
      Returns:
      A new instance of the Jsonable class.
      Throws:
      VonageUnexpectedException - If a no-args constructor for the class was not found.
      VonageResponseParseException - If the JSON was invalid or this class couldn't be updated.