org.waveprotocol.wave.federation.gson.ProtocolWaveletOperationGsonImpl.java Source code

Java tutorial

Introduction

Here is the source code for org.waveprotocol.wave.federation.gson.ProtocolWaveletOperationGsonImpl.java

Source

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.waveprotocol.wave.federation.gson;

// Import order matters here due to what looks like a javac bug.
// Eclipse doesn't seem to have this problem.
import org.waveprotocol.wave.communication.gson.GsonSerializable;

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
import org.waveprotocol.wave.federation.ProtocolWaveletOperation;
import org.waveprotocol.wave.federation.ProtocolWaveletOperationUtil;
import org.waveprotocol.wave.federation.impl.ProtocolWaveletOperationImpl;

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
import org.waveprotocol.wave.federation.ProtocolWaveletOperation.MutateDocument;
import org.waveprotocol.wave.federation.ProtocolWaveletOperationUtil.MutateDocumentUtil;
import org.waveprotocol.wave.federation.impl.ProtocolWaveletOperationImpl.MutateDocumentImpl;
import org.waveprotocol.wave.federation.ProtocolWaveletOperation.MutateDocument;
import org.waveprotocol.wave.federation.ProtocolDocumentOperation;
import org.waveprotocol.wave.federation.gson.ProtocolWaveletOperationGsonImpl.MutateDocumentGsonImpl;
import org.waveprotocol.wave.federation.gson.ProtocolDocumentOperationGsonImpl;
import org.waveprotocol.wave.communication.Blob;
import org.waveprotocol.wave.communication.ProtoEnums;
import org.waveprotocol.wave.communication.gson.GsonException;
import org.waveprotocol.wave.communication.gson.GsonUtil;
import org.waveprotocol.wave.communication.json.RawStringData;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;

/**
 * Pojo implementation of ProtocolWaveletOperation with gson serialization and deserialization.
 *
 * Generated from org/waveprotocol/wave/federation/federation.protodevel. Do not edit.
 */

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
public final class ProtocolWaveletOperationGsonImpl extends ProtocolWaveletOperationImpl
        implements GsonSerializable {

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements. See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership. The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License. You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    public static final class MutateDocumentGsonImpl extends MutateDocumentImpl implements GsonSerializable {
        public MutateDocumentGsonImpl() {
            super();
        }

        public MutateDocumentGsonImpl(MutateDocument message) {
            super(message);
        }

        @Override
        public JsonElement toGson(RawStringData raw, Gson gson) {
            return toGsonHelper(this, raw, gson);
        }

        /**
         * Static implementation-independent GSON serializer. Call this from
         * {@link #toGson} to avoid subclassing issues with inner message types.
         */
        public static JsonElement toGsonHelper(MutateDocument message, RawStringData raw, Gson gson) {
            JsonObject json = new JsonObject();

            /**
             * Licensed to the Apache Software Foundation (ASF) under one
             * or more contributor license agreements. See the NOTICE file
             * distributed with this work for additional information
             * regarding copyright ownership. The ASF licenses this file
             * to you under the Apache License, Version 2.0 (the
             * "License"); you may not use this file except in compliance
             * with the License. You may obtain a copy of the License at
             *
             * http://www.apache.org/licenses/LICENSE-2.0
             *
             * Unless required by applicable law or agreed to in writing,
             * software distributed under the License is distributed on an
             * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
             * KIND, either express or implied. See the License for the
             * specific language governing permissions and limitations
             * under the License.
             */

            /**
             * Licensed to the Apache Software Foundation (ASF) under one
             * or more contributor license agreements. See the NOTICE file
             * distributed with this work for additional information
             * regarding copyright ownership. The ASF licenses this file
             * to you under the Apache License, Version 2.0 (the
             * "License"); you may not use this file except in compliance
             * with the License. You may obtain a copy of the License at
             *
             * http://www.apache.org/licenses/LICENSE-2.0
             *
             * Unless required by applicable law or agreed to in writing,
             * software distributed under the License is distributed on an
             * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
             * KIND, either express or implied. See the License for the
             * specific language governing permissions and limitations
             * under the License.
             */
            json.add("1", new JsonPrimitive(message.getDocumentId()));

            /**
             * Licensed to the Apache Software Foundation (ASF) under one
             * or more contributor license agreements. See the NOTICE file
             * distributed with this work for additional information
             * regarding copyright ownership. The ASF licenses this file
             * to you under the Apache License, Version 2.0 (the
             * "License");
             you may not use this file except in compliance
             * with the License. You may obtain a copy of the License at
             *
             * http://www.apache.org/licenses/LICENSE-2.0
             *
             * Unless required by applicable law or agreed to in writing,
             * software distributed under the License is distributed on an
             * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
             * KIND, either express or implied. See the License for the
             * specific language governing permissions and limitations
             * under the License.
             */

            /**
             * Licensed to the Apache Software Foundation (ASF) under one
             * or more contributor license agreements. See the NOTICE file
             * distributed with this work for additional information
             * regarding copyright ownership. The ASF licenses this file
             * to you under the Apache License, Version 2.0 (the
             * "License"); you may not use this file except in compliance
             * with the License. You may obtain a copy of the License at
             *
             * http://www.apache.org/licenses/LICENSE-2.0
             *
             * Unless required by applicable law or agreed to in writing,
             * software distributed under the License is distributed on an
             * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
             * KIND, either express or implied. See the License for the
             * specific language governing permissions and limitations
             * under the License.
             */
            json.add("2",
                    ProtocolDocumentOperationGsonImpl.toGsonHelper(message.getDocumentOperation(), raw, gson));
            return json;
        }

        @Override
        public void fromGson(JsonElement json, Gson gson, RawStringData raw) throws GsonException {
            reset();
            JsonObject jsonObject = json.getAsJsonObject();
            // NOTE: always check with has(...) as the json might not have all required
            // fields set.

            /**
             * Licensed to the Apache Software Foundation (ASF) under one
             * or more contributor license agreements. See the NOTICE file
             * distributed with this work for additional information
             * regarding copyright ownership. The ASF licenses this file
             * to you under the Apache License, Version 2.0 (the
             * "License"); you may not use this file except in compliance
             * with the License. You may obtain a copy of the License at
             *
             * http://www.apache.org/licenses/LICENSE-2.0
             *
             * Unless required by applicable law or agreed to in writing,
             * software distributed under the License is distributed on an
             * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
             * KIND, either express or implied. See the License for the
             * specific language governing permissions and limitations
             * under the License.
             */
            if (jsonObject.has("1")) {

                /**
                 * Licensed to the Apache Software Foundation (ASF) under one
                 * or more contributor license agreements. See the NOTICE file
                 * distributed with this work for additional information
                 * regarding copyright ownership. The ASF licenses this file
                 * to you under the Apache License, Version 2.0 (the
                 * "License"); you may not use this file except in compliance
                 * with the License. You may obtain a copy of the License at
                 *
                 * http://www.apache.org/licenses/LICENSE-2.0
                 *
                 * Unless required by applicable law or agreed to in writing,
                 * software distributed under the License is distributed on an
                 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
                 * KIND, either express or implied. See the License for the
                 * specific language governing permissions and limitations
                 * under the License.
                 */
                setDocumentId(jsonObject.get("1").getAsString());
            }

            /**
             * Licensed to the Apache Software Foundation (ASF) under one
             * or more contributor license agreements. See the NOTICE file
             * distributed with this work for additional information
             * regarding copyright ownership. The ASF licenses this file
             * to you under the Apache License, Version 2.0 (the
             * "License"); you may not use this file except in compliance
             * with the License. You may obtain a copy of the License at
             *
             * http://www.apache.org/licenses/LICENSE-2.0
             *
             * Unless required by applicable law or agreed to in writing,
             * software distributed under the License is distributed on an
             * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
             * KIND, either express or implied. See the License for the
             * specific language governing permissions and limitations
             * under the License.
             */
            if (jsonObject.has("2")) {

                /**
                 * Licensed to the Apache Software Foundation (ASF) under one
                 * or more contributor license agreements. See the NOTICE file
                 * distributed with this work for additional information
                 * regarding copyright ownership. The ASF licenses this file
                 * to you under the Apache License, Version 2.0 (the
                 * "License"); you may not use this file except in compliance
                 * with the License. You may obtain a copy of the License at
                 *
                 * http://www.apache.org/licenses/LICENSE-2.0
                 *
                 * Unless required by applicable law or agreed to in writing,
                 * software distributed under the License is distributed on an
                 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
                 * KIND, either express or implied. See the License for the
                 * specific language governing permissions and limitations
                 * under the License.
                 */
                ProtocolDocumentOperationGsonImpl payload = new ProtocolDocumentOperationGsonImpl();
                GsonUtil.extractJsonObject(payload, jsonObject.get("2"), gson, raw);
                setDocumentOperation(payload);
            }
        }

    }

    public ProtocolWaveletOperationGsonImpl() {
        super();
    }

    public ProtocolWaveletOperationGsonImpl(ProtocolWaveletOperation message) {
        super(message);
    }

    @Override
    public JsonElement toGson(RawStringData raw, Gson gson) {
        return toGsonHelper(this, raw, gson);
    }

    /**
     * Static implementation-independent GSON serializer. Call this from
     * {@link #toGson} to avoid subclassing issues with inner message types.
     */
    public static JsonElement toGsonHelper(ProtocolWaveletOperation message, RawStringData raw, Gson gson) {
        JsonObject json = new JsonObject();

        /**
         * Licensed to the Apache Software Foundation (ASF) under one
         * or more contributor license agreements. See the NOTICE file
         * distributed with this work for additional information
         * regarding copyright ownership. The ASF licenses this file
         * to you under the Apache License, Version 2.0 (the
         * "License"); you may not use this file except in compliance
         * with the License. You may obtain a copy of the License at
         *
         * http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing,
         * software distributed under the License is distributed on an
         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         * KIND, either express or implied. See the License for the
         * specific language governing permissions and limitations
         * under the License.
         */
        if (message.hasAddParticipant()) {

            /**
             * Licensed to the Apache Software Foundation (ASF) under one
             * or more contributor license agreements. See the NOTICE file
             * distributed with this work for additional information
             * regarding copyright ownership. The ASF licenses this file
             * to you under the Apache License, Version 2.0 (the
             * "License"); you may not use this file except in compliance
             * with the License. You may obtain a copy of the License at
             *
             * http://www.apache.org/licenses/LICENSE-2.0
             *
             * Unless required by applicable law or agreed to in writing,
             * software distributed under the License is distributed on an
             * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
             * KIND, either express or implied. See the License for the
             * specific language governing permissions and limitations
             * under the License.
             */
            json.add("1", new JsonPrimitive(message.getAddParticipant()));
        }

        /**
         * Licensed to the Apache Software Foundation (ASF) under one
         * or more contributor license agreements. See the NOTICE file
         * distributed with this work for additional information
         * regarding copyright ownership. The ASF licenses this file
         * to you under the Apache License, Version 2.0 (the
         * "License"); you may not use this file except in compliance
         * with the License. You may obtain a copy of the License at
         *
         * http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing,
         * software distributed under the License is distributed on an
         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         * KIND, either express or implied. See the License for the
         * specific language governing permissions and limitations
         * under the License.
         */
        if (message.hasRemoveParticipant()) {

            /**
             * Licensed to the Apache Software Foundation (ASF) under one
             * or more contributor license agreements. See the NOTICE file
             * distributed with this work for additional information
             * regarding copyright ownership. The ASF licenses this file
             * to you under the Apache License, Version 2.0 (the
             * "License"); you may not use this file except in compliance
             * with the License. You may obtain a copy of the License at
             *
             * http://www.apache.org/licenses/LICENSE-2.0
             *
             * Unless required by applicable law or agreed to in writing,
             * software distributed under the License is distributed on an
             * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
             * KIND, either express or implied. See the License for the
             * specific language governing permissions and limitations
             * under the License.
             */
            json.add("2", new JsonPrimitive(message.getRemoveParticipant()));
        }

        /**
         * Licensed to the Apache Software Foundation (ASF) under one
         * or more contributor license agreements. See the NOTICE file
         * distributed with this work for additional information
         * regarding copyright ownership. The ASF licenses this file
         * to you under the Apache License, Version 2.0 (the
         * "License"); you may not use this file except in compliance
         * with the License. You may obtain a copy of the License at
         *
         * http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing,
         * software distributed under the License is distributed on an
         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         * KIND, either express or implied. See the License for the
         * specific language governing permissions and limitations
         * under the License.
         */
        if (message.hasMutateDocument()) {

            /**
             * Licensed to the Apache Software Foundation (ASF) under one
             * or more contributor license agreements. See the NOTICE file
             * distributed with this work for additional information
             * regarding copyright ownership. The ASF licenses this file
             * to you under the Apache License, Version 2.0 (the
             * "License"); you may not use this file except in compliance
             * with the License. You may obtain a copy of the License at
             *
             * http://www.apache.org/licenses/LICENSE-2.0
             *
             * Unless required by applicable law or agreed to in writing,
             * software distributed under the License is distributed on an
             * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
             * KIND, either express or implied. See the License for the
             * specific language governing permissions and limitations
             * under the License.
             */
            json.add("3", MutateDocumentGsonImpl.toGsonHelper(message.getMutateDocument(), raw, gson));
        }

        /**
         * Licensed to the Apache Software Foundation (ASF) under one
         * or more contributor license agreements. See the NOTICE file
         * distributed with this work for additional information
         * regarding copyright ownership. The ASF licenses this file
         * to you under the Apache License, Version 2.0 (the
         * "License"); you may not use this file except in compliance
         * with the License. You may obtain a copy of the License at
         *
         * http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing,
         * software distributed under the License is distributed on an
         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         * KIND, either express or implied. See the License for the
         * specific language governing permissions and limitations
         * under the License.
         */
        if (message.hasNoOp()) {

            /**
             * Licensed to the Apache Software Foundation (ASF) under one
             * or more contributor license agreements. See the NOTICE file
             * distributed with this work for additional information
             * regarding copyright ownership. The ASF licenses this file
             * to you under the Apache License, Version 2.0 (the
             * "License"); you may not use this file except in compliance
             * with the License. You may obtain a copy of the License at
             *
             * http://www.apache.org/licenses/LICENSE-2.0
             *
             * Unless required by applicable law or agreed to in writing,
             * software distributed under the License is distributed on an
             * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
             * KIND, either express or implied. See the License for the
             * specific language governing permissions and limitations
             * under the License.
             */
            json.add("4", new JsonPrimitive(message.getNoOp()));
        }
        return json;
    }

    @Override
    public void fromGson(JsonElement json, Gson gson, RawStringData raw) throws GsonException {
        reset();
        JsonObject jsonObject = json.getAsJsonObject();
        // NOTE: always check with has(...) as the json might not have all required
        // fields set.

        /**
         * Licensed to the Apache Software Foundation (ASF) under one
         * or more contributor license agreements. See the NOTICE file
         * distributed with this work for additional information
         * regarding copyright ownership. The ASF licenses this file
         * to you under the Apache License, Version 2.0 (the
         * "License"); you may not use this file except in compliance
         * with the License. You may obtain a copy of the License at
         *
         * http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing,
         * software distributed under the License is distributed on an
         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         * KIND, either express or implied. See the License for the
         * specific language governing permissions and limitations
         * under the License.
         */
        if (jsonObject.has("1")) {
            JsonElement elem = jsonObject.get("1");
            if (!elem.isJsonNull()) {

                /**
                 * Licensed to the Apache Software Foundation (ASF) under one
                 * or more contributor license agreements. See the NOTICE file
                 * distributed with this work for additional information
                 * regarding copyright ownership. The ASF licenses this file
                 * to you under the Apache License, Version 2.0 (the
                 * "License"); you may not use this file except in compliance
                 * with the License. You may obtain a copy of the License at
                 *
                 * http://www.apache.org/licenses/LICENSE-2.0
                 *
                 * Unless required by applicable law or agreed to in writing,
                 * software distributed under the License is distributed on an
                 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
                 * KIND, either express or implied. See the License for the
                 * specific language governing permissions and limitations
                 * under the License.
                 */
                setAddParticipant(elem.getAsString());
            }
        }

        /**
         * Licensed to the Apache Software Foundation (ASF) under one
         * or more contributor license agreements. See the NOTICE file
         * distributed with this work for additional information
         * regarding copyright ownership. The ASF licenses this file
         * to you under the Apache License, Version 2.0 (the
         * "License"); you may not use this file except in compliance
         * with the License. You may obtain a copy of the License at
         *
         * http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing,
         * software distributed under the License is distributed on an
         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         * KIND, either express or implied. See the License for the
         * specific language governing permissions and limitations
         * under the License.
         */
        if (jsonObject.has("2")) {
            JsonElement elem = jsonObject.get("2");
            if (!elem.isJsonNull()) {

                /**
                 * Licensed to the Apache Software Foundation (ASF) under one
                 * or more contributor license agreements. See the NOTICE file
                 * distributed with this work for additional information
                 * regarding copyright ownership. The ASF licenses this file
                 * to you under the Apache License, Version 2.0 (the
                 * "License"); you may not use this file except in compliance
                 * with the License. You may obtain a copy of the License at
                 *
                 * http://www.apache.org/licenses/LICENSE-2.0
                 *
                 * Unless required by applicable law or agreed to in writing,
                 * software distributed under the License is distributed on an
                 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
                 * KIND, either express or implied. See the License for the
                 * specific language governing permissions and limitations
                 * under the License.
                 */
                setRemoveParticipant(elem.getAsString());
            }
        }

        /**
         * Licensed to the Apache Software Foundation (ASF) under one
         * or more contributor license agreements. See the NOTICE file
         * distributed with this work for additional information
         * regarding copyright ownership. The ASF licenses this file
         * to you under the Apache License, Version 2.0 (the
         * "License"); you may not use this file except in compliance
         * with the License. You may obtain a copy of the License at
         *
         * http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing,
         * software distributed under the License is distributed on an
         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         * KIND, either express or implied. See the License for the
         * specific language governing permissions and limitations
         * under the License.
         */
        if (jsonObject.has("3")) {
            JsonElement elem = jsonObject.get("3");
            if (!elem.isJsonNull()) {

                /**
                 * Licensed to the Apache Software Foundation (ASF) under one
                 * or more contributor license agreements. See the NOTICE file
                 * distributed with this work for additional information
                 * regarding copyright ownership. The ASF licenses this file
                 * to you under the Apache License, Version 2.0 (the
                 * "License"); you may not use this file except in compliance
                 * with the License. You may obtain a copy of the License at
                 *
                 * http://www.apache.org/licenses/LICENSE-2.0
                 *
                 * Unless required by applicable law or agreed to in writing,
                 * software distributed under the License is distributed on an
                 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
                 * KIND, either express or implied. See the License for the
                 * specific language governing permissions and limitations
                 * under the License.
                 */
                MutateDocumentGsonImpl payload = new MutateDocumentGsonImpl();
                GsonUtil.extractJsonObject(payload, elem, gson, raw);
                setMutateDocument(payload);
            }
        }

        /**
         * Licensed to the Apache Software Foundation (ASF) under one
         * or more contributor license agreements. See the NOTICE file
         * distributed with this work for additional information
         * regarding copyright ownership. The ASF licenses this file
         * to you under the Apache License, Version 2.0 (the
         * "License"); you may not use this file except in compliance
         * with the License. You may obtain a copy of the License at
         *
         * http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing,
         * software distributed under the License is distributed on an
         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         * KIND, either express or implied. See the License for the
         * specific language governing permissions and limitations
         * under the License.
         */
        if (jsonObject.has("4")) {
            JsonElement elem = jsonObject.get("4");
            if (!elem.isJsonNull()) {

                /**
                 * Licensed to the Apache Software Foundation (ASF) under one
                 * or more contributor license agreements. See the NOTICE file
                 * distributed with this work for additional information
                 * regarding copyright ownership. The ASF licenses this file
                 * to you under the Apache License, Version 2.0 (the
                 * "License"); you may not use this file except in compliance
                 * with the License. You may obtain a copy of the License at
                 *
                 * http://www.apache.org/licenses/LICENSE-2.0
                 *
                 * Unless required by applicable law or agreed to in writing,
                 * software distributed under the License is distributed on an
                 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
                 * KIND, either express or implied. See the License for the
                 * specific language governing permissions and limitations
                 * under the License.
                 */
                setNoOp(elem.getAsBoolean());
            }
        }
    }

}