org.waveprotocol.wave.federation.proto.ProtocolAppliedWaveletDeltaProtoImpl.java Source code

Java tutorial

Introduction

Here is the source code for org.waveprotocol.wave.federation.proto.ProtocolAppliedWaveletDeltaProtoImpl.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.proto;

/**
 * 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.ProtocolSignedDelta;
import org.waveprotocol.wave.federation.ProtocolHashedVersion;
import org.waveprotocol.wave.federation.proto.ProtocolSignedDeltaProtoImpl;
import org.waveprotocol.wave.federation.proto.ProtocolHashedVersionProtoImpl;

/**
 * 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.ProtocolAppliedWaveletDelta;
import org.waveprotocol.wave.federation.ProtocolAppliedWaveletDeltaUtil;
import org.waveprotocol.wave.communication.Blob;
import org.waveprotocol.wave.communication.Codec;
import org.waveprotocol.wave.communication.ProtoEnums;
import org.waveprotocol.wave.communication.proto.Int52;
import org.waveprotocol.wave.communication.proto.ProtoWrapper;
import org.waveprotocol.wave.communication.gson.GsonException;
import org.waveprotocol.wave.communication.gson.GsonSerializable;
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;
import com.google.protobuf.ByteString;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Server implementation of ProtocolAppliedWaveletDelta.
 *
 * 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.
 */
// NOTE(kalman): It would be nicer to add a proto serialisation
// utility rather than having this class at all.
public final class ProtocolAppliedWaveletDeltaProtoImpl implements ProtocolAppliedWaveletDelta,
        // Note: fully-qualified path is required for GsonSerializable and ProtoWrapper.
        // An import of it is not resolved correctly from inner classes.
        // This appears to be a javac bug. The Eclipse compiler handles it fine.
        org.waveprotocol.wave.communication.gson.GsonSerializable,
        org.waveprotocol.wave.communication.proto.ProtoWrapper<org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta> {
    private org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta proto = null;
    private org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta.Builder protoBuilder = org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta
            .newBuilder();

    public ProtocolAppliedWaveletDeltaProtoImpl() {
    }

    public ProtocolAppliedWaveletDeltaProtoImpl(
            org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta proto) {
        this.proto = proto;
    }

    public ProtocolAppliedWaveletDeltaProtoImpl(ProtocolAppliedWaveletDelta message) {
        copyFrom(message);
    }

    @Override
    public org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta getPB() {
        switchToProto();
        return proto;
    }

    @Override
    public void setPB(org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta proto) {
        this.proto = proto;
        this.protoBuilder = null;
    }

    @Override
    public void copyFrom(ProtocolAppliedWaveletDelta message) {

        /**
         * 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.
         */
        setSignedOriginalDelta(new ProtocolSignedDeltaProtoImpl(message.getSignedOriginalDelta()));

        /**
         * 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.hasHashedVersionAppliedAt()) {
            setHashedVersionAppliedAt(new ProtocolHashedVersionProtoImpl(message.getHashedVersionAppliedAt()));
        } else {
            clearHashedVersionAppliedAt();
        }

        /**
         * 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.
         */
        setOperationsApplied(message.getOperationsApplied());

        /**
         * 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.
         */
        setApplicationTimestamp(message.getApplicationTimestamp());
    }

    /**
     * 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.
     */

    @Override
    public ProtocolSignedDeltaProtoImpl getSignedOriginalDelta() {
        switchToProto();
        return new ProtocolSignedDeltaProtoImpl(proto.getSignedOriginalDelta());
    }

    @Override
    public void setSignedOriginalDelta(ProtocolSignedDelta value) {
        switchToProtoBuilder();
        protoBuilder.clearSignedOriginalDelta();
        protoBuilder.setSignedOriginalDelta(getOrCreateProtocolSignedDeltaProtoImpl(value).getPB());
    }

    /**
     * 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.
     */

    @Override
    public boolean hasHashedVersionAppliedAt() {
        switchToProto();
        return proto.hasHashedVersionAppliedAt();
    }

    @Override
    public void clearHashedVersionAppliedAt() {
        switchToProtoBuilder();
        protoBuilder.clearHashedVersionAppliedAt();
    }

    @Override
    public ProtocolHashedVersionProtoImpl getHashedVersionAppliedAt() {
        switchToProto();
        return new ProtocolHashedVersionProtoImpl(proto.getHashedVersionAppliedAt());
    }

    @Override
    public void setHashedVersionAppliedAt(ProtocolHashedVersion value) {
        switchToProtoBuilder();
        protoBuilder.clearHashedVersionAppliedAt();
        protoBuilder.setHashedVersionAppliedAt(getOrCreateProtocolHashedVersionProtoImpl(value).getPB());
    }

    /**
     * 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.
     */

    @Override
    public int getOperationsApplied() {
        switchToProto();
        return proto.getOperationsApplied();
    }

    @Override
    public void setOperationsApplied(int value) {
        switchToProtoBuilder();
        protoBuilder.setOperationsApplied(value);
    }

    /**
     * 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.
     */

    @Override
    public double getApplicationTimestamp() {
        switchToProto();
        return proto.getApplicationTimestamp();
    }

    @Override
    public void setApplicationTimestamp(double value) {
        switchToProtoBuilder();
        protoBuilder.setApplicationTimestamp(Int52.int52to64(value));
    }

    /**
     * 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.
     */

    /** Get or create a ProtocolSignedDeltaProtoImpl from a ProtocolSignedDelta. */
    private ProtocolSignedDeltaProtoImpl getOrCreateProtocolSignedDeltaProtoImpl(ProtocolSignedDelta message) {
        if (message instanceof ProtocolSignedDeltaProtoImpl) {
            return (ProtocolSignedDeltaProtoImpl) message;
        } else {
            ProtocolSignedDeltaProtoImpl messageImpl = new ProtocolSignedDeltaProtoImpl();
            messageImpl.copyFrom(message);
            return messageImpl;
        }
    }

    /**
     * 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.
     */

    /** Get or create a ProtocolHashedVersionProtoImpl from a ProtocolHashedVersion. */
    private ProtocolHashedVersionProtoImpl getOrCreateProtocolHashedVersionProtoImpl(
            ProtocolHashedVersion message) {
        if (message instanceof ProtocolHashedVersionProtoImpl) {
            return (ProtocolHashedVersionProtoImpl) message;
        } else {
            ProtocolHashedVersionProtoImpl messageImpl = new ProtocolHashedVersionProtoImpl();
            messageImpl.copyFrom(message);
            return messageImpl;
        }
    }

    private void switchToProto() {
        if (proto == null) {
            proto = protoBuilder.build();
            protoBuilder = null;
        }
    }

    private void switchToProtoBuilder() {
        if (protoBuilder == null) {
            protoBuilder = (proto == null)
                    ? org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta.newBuilder()
                    : org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta.newBuilder(proto);
            proto = null;
        }
    }

    private void invalidateAll() {
        proto = null;
        protoBuilder = org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta.newBuilder();
    }

    @Override
    public JsonElement toGson(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.
         */
        {
            JsonElement elem = ((GsonSerializable) getSignedOriginalDelta()).toGson(raw, gson);
            json.add("1", elem);
        }

        /**
         * 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 (hasHashedVersionAppliedAt()) {
            {
                JsonElement elem = ((GsonSerializable) getHashedVersionAppliedAt()).toGson(raw, gson);
                json.add("2", elem);
            }
        }

        /**
         * 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", new JsonPrimitive(getOperationsApplied()));

        /**
         * 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(getApplicationTimestamp()));
        return json;
    }

    @Override
    public void fromGson(JsonElement json, Gson gson, RawStringData raw) throws GsonException {
        JsonObject jsonObject = json.getAsJsonObject();
        // NOTE: always check with has(...) as the json might not have all required
        // fields set; however these (obviously) will need to be set by other means
        // before accessing this object.
        invalidateAll();

        /**
         * 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");
            {
                ProtocolSignedDeltaProtoImpl payload = new ProtocolSignedDeltaProtoImpl();
                GsonUtil.extractJsonObject(payload, elem, gson, raw);
                setSignedOriginalDelta(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("2")) {
            JsonElement elem = jsonObject.get("2");
            if (!elem.isJsonNull()) {
                {
                    ProtocolHashedVersionProtoImpl payload = new ProtocolHashedVersionProtoImpl();
                    GsonUtil.extractJsonObject(payload, elem, gson, raw);
                    setHashedVersionAppliedAt(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("3")) {
            JsonElement elem = jsonObject.get("3");
            setOperationsApplied(elem.getAsInt());
        }

        /**
         * 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");
            setApplicationTimestamp(elem.getAsDouble());
        }
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        } else if (o instanceof ProtocolAppliedWaveletDeltaProtoImpl) {
            return getPB().equals(((ProtocolAppliedWaveletDeltaProtoImpl) o).getPB());
        } else {
            return false;
        }
    }

    @Override
    public boolean isEqualTo(Object o) {
        if (equals(o)) {
            return true;
        } else if (o instanceof ProtocolAppliedWaveletDelta) {
            return ProtocolAppliedWaveletDeltaUtil.isEqual(this, (ProtocolAppliedWaveletDelta) o);
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return getPB().hashCode();
    }

    @Override
    public String toString() {
        return getPB().toString();
    }

}