private static JsonObject getFieldOperationJsonObject ( FieldOperation fieldOperation ) { JsonObject jsonObject = new JsonObject ( ) ; jsonObject . add ( "op" , fieldOperation . getOp ( ) . toString ( ) ) ; String fieldKey = fieldOperation . getFieldKey ( ) ; if ( fieldKey != null ) { jsonObject . add ( "fieldKey" , fieldKey ) ; } Field field = fieldOperation . getData ( ) ; if ( field != null ) { JsonObject fieldObj = new JsonObject ( ) ; String type = field . getType ( ) ; if ( type != null ) { fieldObj . add ( "type" , type ) ; } String key = field . getKey ( ) ; if ( key != null ) { fieldObj . add ( "key" , key ) ; } String displayName = field . getDisplayName ( ) ; if ( displayName != null ) { fieldObj . add ( "displayName" , displayName ) ; } String description = field . getDescription ( ) ; if ( description != null ) { fieldObj . add ( "description" , description ) ; } Boolean hidden = field . getIsHidden ( ) ; if ( hidden != null ) { fieldObj . add ( "hidden" , hidden ) ; } List < String > options = field . getOptions ( ) ; if ( options != null ) { JsonArray array = new JsonArray ( ) ; for ( String option : options ) { JsonObject optionObj = new JsonObject ( ) ; optionObj . add ( "key" , option ) ; array . add ( optionObj ) ; } fieldObj . add ( "options" , array ) ; } jsonObject . add ( "data" , fieldObj ) ; } List < String > fieldKeys = fieldOperation . getFieldKeys ( ) ; if ( fieldKeys != null ) { jsonObject . add ( "fieldKeys" , getJsonArray ( fieldKeys ) ) ; } List < String > enumOptionKeys = fieldOperation . getEnumOptionKeys ( ) ; if ( enumOptionKeys != null ) { jsonObject . add ( "enumOptionKeys" , getJsonArray ( enumOptionKeys ) ) ; } String enumOptionKey = fieldOperation . getEnumOptionKey ( ) ; if ( enumOptionKey != null ) { jsonObject . add ( "enumOptionKey" , enumOptionKey ) ; } String multiSelectOptionKey = fieldOperation . getMultiSelectOptionKey ( ) ; if ( multiSelectOptionKey != null ) { jsonObject . add ( "multiSelectOptionKey" , multiSelectOptionKey ) ; } List < String > multiSelectOptionKeys = fieldOperation . getMultiSelectOptionKeys ( ) ; if ( multiSelectOptionKeys != null ) { jsonObject . add ( "multiSelectOptionKeys" , getJsonArray ( multiSelectOptionKeys ) ) ; } return jsonObject ; }
Gets the JsonObject representation of the Field Operation .