Package org.waveprotocol.wave.federation.jso

Source Code of org.waveprotocol.wave.federation.jso.ProtocolSignatureJsoImpl

/**
* 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.ProtocolSignature.SignatureAlgorithm;
import org.waveprotocol.wave.federation.ProtocolSignature;
import org.waveprotocol.wave.federation.ProtocolSignatureUtil;
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 ProtocolSignature 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 ProtocolSignatureJsoImpl extends org.waveprotocol.wave.communication.gwt.JsonMessage
    implements ProtocolSignature {
  private static final String keySignatureBytes = "1";
  private static final String keySignerId = "2";
  private static final String keySignatureAlgorithm = "3";
  protected ProtocolSignatureJsoImpl() {
  }

  public static ProtocolSignatureJsoImpl create() {
    ProtocolSignatureJsoImpl instance = (ProtocolSignatureJsoImpl) 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(ProtocolSignature message) {
    super.copyFrom((ProtocolSignatureJsoImpl) message);
  }

  @Override
  public Blob getSignatureBytes() {
    return hasProperty(this, keySignatureBytes) ? new Blob(getPropertyAsString(this, keySignatureBytes)) : null;
  }

  @Override
  public void setSignatureBytes(Blob blob) {
    setPropertyAsString(this, keySignatureBytes, blob.getData());
  }

  @Override
  public Blob getSignerId() {
    return hasProperty(this, keySignerId) ? new Blob(getPropertyAsString(this, keySignerId)) : null;
  }

  @Override
  public void setSignerId(Blob blob) {
    setPropertyAsString(this, keySignerId, blob.getData());
  }

  @Override
  public SignatureAlgorithm getSignatureAlgorithm() {
    return hasProperty(this, keySignatureAlgorithm) ? ProtoEnums.valOf(getPropertyAsInteger(this, keySignatureAlgorithm), SignatureAlgorithm.values()) : null;
  }

  @Override
  public void setSignatureAlgorithm(SignatureAlgorithm enumValue) {
    setPropertyAsInteger(this, keySignatureAlgorithm, enumValue.getValue());
  }

  @Override
  public boolean isEqualTo(Object o) {
    if (o instanceof ProtocolSignatureJsoImpl) {
      return nativeIsEqualTo(o);
    } else if (o instanceof ProtocolSignature) {
      return ProtocolSignatureUtil.isEqual(this, (ProtocolSignature) o);
    } else {
      return false;
    }
  }

}
TOP

Related Classes of org.waveprotocol.wave.federation.jso.ProtocolSignatureJsoImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.