public JsonObject toJson ( ) { final JsonObjectBuilder builder = Json . createObjectBuilder ( ) ; builder . add ( EL_DATA_TYPE , dataType ) ; builder . add ( EL_DATA_CONTENT_TYPE , dataContentTypeStr ) ; if ( meta == null ) { return builder . build ( ) ; } builder . add ( EL_META_TYPE , metaType ) ; builder . add ( EL_META_CONTENT_TYPE , metaContentTypeStr ) ; if ( meta instanceof JsonObject ) { final JsonObject jo = ( JsonObject ) meta ; return builder . add ( metaType , jo ) . build ( ) ; } if ( meta instanceof ToJsonCapable ) { final ToJsonCapable tjc = ( ToJsonCapable ) meta ; return builder . add ( metaType , tjc . toJson ( ) ) . build ( ) ; } if ( meta instanceof Base64Data ) { final Base64Data base64data = ( Base64Data ) meta ; return builder . add ( metaType , base64data . getEncoded ( ) ) . build ( ) ; } throw new IllegalStateException ( "Unknown meta object type: " + meta . getClass ( ) ) ; }
Converts the object into a JSON object .