/**
* Copyright 2010 Google Inc.
*
* Licensed 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.jso;
import static org.waveprotocol.wave.communication.gwt.JsonHelper.*;
import com.google.gwt.core.client.*;
import org.waveprotocol.wave.federation.ProtocolHashedVersion;
import org.waveprotocol.wave.federation.ProtocolHashedVersionUtil;
import org.waveprotocol.wave.communication.Blob;
import org.waveprotocol.wave.communication.ProtoEnums;
import org.waveprotocol.wave.communication.gwt.*;
import org.waveprotocol.wave.communication.json.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Client implementation of ProtocolHashedVersion backed by a GWT JavaScriptObject.
*
* Generated from org/waveprotocol/wave/federation/federation.protodevel. Do not edit.
*/
// We have to use fully-qualified name of the GsonSerializable class here in order to make it
// visible in case of nested classes.
public final class ProtocolHashedVersionJsoImpl extends org.waveprotocol.wave.communication.gwt.JsonMessage
implements ProtocolHashedVersion {
private static final String keyVersion = "1";
private static final String keyHistoryHash = "2";
protected ProtocolHashedVersionJsoImpl() {
}
public static ProtocolHashedVersionJsoImpl create() {
ProtocolHashedVersionJsoImpl instance = (ProtocolHashedVersionJsoImpl) JsonMessage.createJsonMessage();
// Force all lists to start with an empty list rather than no property for
// the list. This is so that the native JS equality works, since (obviously)
// {} != {"foo": []} while in the context of messages they should be.
return instance;
}
@Override
public void copyFrom(ProtocolHashedVersion message) {
super.copyFrom((ProtocolHashedVersionJsoImpl) message);
}
@Override
public double getVersion() {
return hasProperty(this, keyVersion) ? getPropertyAsDouble(this, keyVersion) : 0L;
}
@Override
public void setVersion(double value) {
setPropertyAsDouble(this, keyVersion, value);
}
@Override
public Blob getHistoryHash() {
return hasProperty(this, keyHistoryHash) ? new Blob(getPropertyAsString(this, keyHistoryHash)) : null;
}
@Override
public void setHistoryHash(Blob blob) {
setPropertyAsString(this, keyHistoryHash, blob.getData());
}
@Override
public boolean isEqualTo(Object o) {
if (o instanceof ProtocolHashedVersionJsoImpl) {
return nativeIsEqualTo(o);
} else if (o instanceof ProtocolHashedVersion) {
return ProtocolHashedVersionUtil.isEqual(this, (ProtocolHashedVersion) o);
} else {
return false;
}
}
}