Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AA155200CD8 for ; Wed, 2 Aug 2017 18:54:35 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A91EF169DB1; Wed, 2 Aug 2017 16:54:35 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 78321169D88 for ; Wed, 2 Aug 2017 18:54:33 +0200 (CEST) Received: (qmail 68340 invoked by uid 500); 2 Aug 2017 16:54:29 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 67894 invoked by uid 99); 2 Aug 2017 16:54:29 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Aug 2017 16:54:29 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7D42AF552C; Wed, 2 Aug 2017 16:54:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: stack@apache.org To: commits@hbase.apache.org Date: Wed, 02 Aug 2017 16:54:47 -0000 Message-Id: In-Reply-To: <0c40a540d84e4e0dbac1024a40afa9c5@git.apache.org> References: <0c40a540d84e4e0dbac1024a40afa9c5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [21/52] [partial] hbase git commit: HBASE-17056 Remove checked in PB generated files archived-at: Wed, 02 Aug 2017 16:54:35 -0000 http://git-wip-us.apache.org/repos/asf/hbase/blob/ee70b1d2/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapEntry.java ---------------------------------------------------------------------- diff --git a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapEntry.java b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapEntry.java deleted file mode 100644 index d586cc7..0000000 --- a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapEntry.java +++ /dev/null @@ -1,449 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.hadoop.hbase.shaded.com.google.protobuf; - -import org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.Descriptor; -import org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.EnumValueDescriptor; -import org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.FieldDescriptor; - -import java.io.IOException; -import java.util.Collections; -import java.util.Map; -import java.util.TreeMap; - -/** - * Implements MapEntry messages. - * - * In reflection API, map fields will be treated as repeated message fields and - * each map entry is accessed as a message. This MapEntry class is used to - * represent these map entry messages in reflection API. - * - * Protobuf internal. Users shouldn't use this class. - */ -public final class MapEntry extends AbstractMessage { - - private static final class Metadata extends MapEntryLite.Metadata { - - public final Descriptor descriptor; - public final Parser> parser; - - public Metadata( - Descriptor descriptor, - MapEntry defaultInstance, - WireFormat.FieldType keyType, - WireFormat.FieldType valueType) { - super(keyType, defaultInstance.key, valueType, defaultInstance.value); - this.descriptor = descriptor; - this.parser = new AbstractParser>() { - - @Override - public MapEntry parsePartialFrom( - CodedInputStream input, ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - return new MapEntry(Metadata.this, input, extensionRegistry); - } - }; - } - } - - private final K key; - private final V value; - private final Metadata metadata; - - /** Create a default MapEntry instance. */ - private MapEntry( - Descriptor descriptor, - WireFormat.FieldType keyType, K defaultKey, - WireFormat.FieldType valueType, V defaultValue) { - this.key = defaultKey; - this.value = defaultValue; - this.metadata = new Metadata(descriptor, this, keyType, valueType); - } - - /** Create a MapEntry with the provided key and value. */ - private MapEntry(Metadata metadata, K key, V value) { - this.key = key; - this.value = value; - this.metadata = metadata; - } - - /** Parsing constructor. */ - private MapEntry( - Metadata metadata, - CodedInputStream input, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - try { - this.metadata = metadata; - Map.Entry entry = MapEntryLite.parseEntry(input, metadata, extensionRegistry); - this.key = entry.getKey(); - this.value = entry.getValue(); - } catch (InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (IOException e) { - throw new InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } - } - - /** - * Create a default MapEntry instance. A default MapEntry instance should be - * created only once for each map entry message type. Generated code should - * store the created default instance and use it later to create new MapEntry - * messages of the same type. - */ - public static MapEntry newDefaultInstance( - Descriptor descriptor, - WireFormat.FieldType keyType, K defaultKey, - WireFormat.FieldType valueType, V defaultValue) { - return new MapEntry( - descriptor, keyType, defaultKey, valueType, defaultValue); - } - - public K getKey() { - return key; - } - - public V getValue() { - return value; - } - - private volatile int cachedSerializedSize = -1; - - @Override - public int getSerializedSize() { - if (cachedSerializedSize != -1) { - return cachedSerializedSize; - } - - int size = MapEntryLite.computeSerializedSize(metadata, key, value); - cachedSerializedSize = size; - return size; - } - - @Override - public void writeTo(CodedOutputStream output) throws IOException { - MapEntryLite.writeTo(output, metadata, key, value); - } - - @Override - public boolean isInitialized() { - return isInitialized(metadata, value); - } - - @Override - public Parser> getParserForType() { - return metadata.parser; - } - - @Override - public Builder newBuilderForType() { - return new Builder(metadata); - } - - @Override - public Builder toBuilder() { - return new Builder(metadata, key, value); - } - - @Override - public MapEntry getDefaultInstanceForType() { - return new MapEntry(metadata, metadata.defaultKey, metadata.defaultValue); - } - - @Override - public Descriptor getDescriptorForType() { - return metadata.descriptor; - } - - @Override - public Map getAllFields() { - TreeMap result = new TreeMap(); - for (final FieldDescriptor field : metadata.descriptor.getFields()) { - if (hasField(field)) { - result.put(field, getField(field)); - } - } - return Collections.unmodifiableMap(result); - } - - private void checkFieldDescriptor(FieldDescriptor field) { - if (field.getContainingType() != metadata.descriptor) { - throw new RuntimeException( - "Wrong FieldDescriptor \"" + field.getFullName() - + "\" used in message \"" + metadata.descriptor.getFullName()); - } - } - - @Override - public boolean hasField(FieldDescriptor field) { - checkFieldDescriptor(field);; - // A MapEntry always contains two fields. - return true; - } - - @Override - public Object getField(FieldDescriptor field) { - checkFieldDescriptor(field); - Object result = field.getNumber() == 1 ? getKey() : getValue(); - // Convert enums to EnumValueDescriptor. - if (field.getType() == FieldDescriptor.Type.ENUM) { - result = field.getEnumType().findValueByNumberCreatingIfUnknown( - (java.lang.Integer) result); - } - return result; - } - - @Override - public int getRepeatedFieldCount(FieldDescriptor field) { - throw new RuntimeException( - "There is no repeated field in a map entry message."); - } - - @Override - public Object getRepeatedField(FieldDescriptor field, int index) { - throw new RuntimeException( - "There is no repeated field in a map entry message."); - } - - @Override - public UnknownFieldSet getUnknownFields() { - return UnknownFieldSet.getDefaultInstance(); - } - - /** - * Builder to create {@link MapEntry} messages. - */ - public static class Builder - extends AbstractMessage.Builder> { - private final Metadata metadata; - private K key; - private V value; - - private Builder(Metadata metadata) { - this(metadata, metadata.defaultKey, metadata.defaultValue); - } - - private Builder(Metadata metadata, K key, V value) { - this.metadata = metadata; - this.key = key; - this.value = value; - } - - public K getKey() { - return key; - } - - public V getValue() { - return value; - } - - public Builder setKey(K key) { - this.key = key; - return this; - } - - public Builder clearKey() { - this.key = metadata.defaultKey; - return this; - } - - public Builder setValue(V value) { - this.value = value; - return this; - } - - public Builder clearValue() { - this.value = metadata.defaultValue; - return this; - } - - @Override - public MapEntry build() { - MapEntry result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @Override - public MapEntry buildPartial() { - return new MapEntry(metadata, key, value); - } - - @Override - public Descriptor getDescriptorForType() { - return metadata.descriptor; - } - - private void checkFieldDescriptor(FieldDescriptor field) { - if (field.getContainingType() != metadata.descriptor) { - throw new RuntimeException( - "Wrong FieldDescriptor \"" + field.getFullName() - + "\" used in message \"" + metadata.descriptor.getFullName()); - } - } - - @Override - public Message.Builder newBuilderForField(FieldDescriptor field) { - checkFieldDescriptor(field);; - // This method should be called for message fields and in a MapEntry - // message only the value field can possibly be a message field. - if (field.getNumber() != 2 - || field.getJavaType() != FieldDescriptor.JavaType.MESSAGE) { - throw new RuntimeException( - "\"" + field.getFullName() + "\" is not a message value field."); - } - return ((Message) value).newBuilderForType(); - } - - @SuppressWarnings("unchecked") - @Override - public Builder setField(FieldDescriptor field, Object value) { - checkFieldDescriptor(field); - if (field.getNumber() == 1) { - setKey((K) value); - } else { - if (field.getType() == FieldDescriptor.Type.ENUM) { - value = ((EnumValueDescriptor) value).getNumber(); - } else if (field.getType() == FieldDescriptor.Type.MESSAGE) { - if (value != null && !metadata.defaultValue.getClass().isInstance(value)) { - // The value is not the exact right message type. However, if it - // is an alternative implementation of the same type -- e.g. a - // DynamicMessage -- we should accept it. In this case we can make - // a copy of the message. - value = - ((Message) metadata.defaultValue).toBuilder().mergeFrom((Message) value).build(); - } - } - setValue((V) value); - } - return this; - } - - @Override - public Builder clearField(FieldDescriptor field) { - checkFieldDescriptor(field); - if (field.getNumber() == 1) { - clearKey(); - } else { - clearValue(); - } - return this; - } - - @Override - public Builder setRepeatedField(FieldDescriptor field, int index, - Object value) { - throw new RuntimeException( - "There is no repeated field in a map entry message."); - } - - @Override - public Builder addRepeatedField(FieldDescriptor field, Object value) { - throw new RuntimeException( - "There is no repeated field in a map entry message."); - } - - @Override - public Builder setUnknownFields(UnknownFieldSet unknownFields) { - // Unknown fields are discarded for MapEntry message. - return this; - } - - @Override - public MapEntry getDefaultInstanceForType() { - return new MapEntry(metadata, metadata.defaultKey, metadata.defaultValue); - } - - @Override - public boolean isInitialized() { - return MapEntry.isInitialized(metadata, value); - } - - @Override - public Map getAllFields() { - final TreeMap result = new TreeMap(); - for (final FieldDescriptor field : metadata.descriptor.getFields()) { - if (hasField(field)) { - result.put(field, getField(field)); - } - } - return Collections.unmodifiableMap(result); - } - - @Override - public boolean hasField(FieldDescriptor field) { - checkFieldDescriptor(field); - return true; - } - - @Override - public Object getField(FieldDescriptor field) { - checkFieldDescriptor(field); - Object result = field.getNumber() == 1 ? getKey() : getValue(); - // Convert enums to EnumValueDescriptor. - if (field.getType() == FieldDescriptor.Type.ENUM) { - result = field.getEnumType().findValueByNumberCreatingIfUnknown((Integer) result); - } - return result; - } - - @Override - public int getRepeatedFieldCount(FieldDescriptor field) { - throw new RuntimeException( - "There is no repeated field in a map entry message."); - } - - @Override - public Object getRepeatedField(FieldDescriptor field, int index) { - throw new RuntimeException( - "There is no repeated field in a map entry message."); - } - - @Override - public UnknownFieldSet getUnknownFields() { - return UnknownFieldSet.getDefaultInstance(); - } - - @Override - public Builder clone() { - return new Builder(metadata, key, value); - } - } - - private static boolean isInitialized(Metadata metadata, V value) { - if (metadata.valueType.getJavaType() == WireFormat.JavaType.MESSAGE) { - return ((MessageLite) value).isInitialized(); - } - return true; - } -} http://git-wip-us.apache.org/repos/asf/hbase/blob/ee70b1d2/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapEntryLite.java ---------------------------------------------------------------------- diff --git a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapEntryLite.java b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapEntryLite.java deleted file mode 100644 index d8a19bb..0000000 --- a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapEntryLite.java +++ /dev/null @@ -1,226 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.hadoop.hbase.shaded.com.google.protobuf; - -import java.io.IOException; -import java.util.AbstractMap; -import java.util.Map; - -/** - * Implements the lite version of map entry messages. - * - * This class serves as an utility class to help do serialization/parsing of - * map entries. It's used in generated code and also in the full version - * MapEntry message. - * - * Protobuf internal. Users shouldn't use. - */ -public class MapEntryLite { - - static class Metadata { - public final WireFormat.FieldType keyType; - public final K defaultKey; - public final WireFormat.FieldType valueType; - public final V defaultValue; - - public Metadata( - WireFormat.FieldType keyType, K defaultKey, - WireFormat.FieldType valueType, V defaultValue) { - this.keyType = keyType; - this.defaultKey = defaultKey; - this.valueType = valueType; - this.defaultValue = defaultValue; - } - } - - private static final int KEY_FIELD_NUMBER = 1; - private static final int VALUE_FIELD_NUMBER = 2; - - private final Metadata metadata; - private final K key; - private final V value; - - /** Creates a default MapEntryLite message instance. */ - private MapEntryLite( - WireFormat.FieldType keyType, K defaultKey, - WireFormat.FieldType valueType, V defaultValue) { - this.metadata = new Metadata(keyType, defaultKey, valueType, defaultValue); - this.key = defaultKey; - this.value = defaultValue; - } - - /** Creates a new MapEntryLite message. */ - private MapEntryLite(Metadata metadata, K key, V value) { - this.metadata = metadata; - this.key = key; - this.value = value; - } - - public K getKey() { - return key; - } - - public V getValue() { - return value; - } - - /** - * Creates a default MapEntryLite message instance. - * - * This method is used by generated code to create the default instance for - * a map entry message. The created default instance should be used to create - * new map entry messages of the same type. For each map entry message, only - * one default instance should be created. - */ - public static MapEntryLite newDefaultInstance( - WireFormat.FieldType keyType, K defaultKey, - WireFormat.FieldType valueType, V defaultValue) { - return new MapEntryLite( - keyType, defaultKey, valueType, defaultValue); - } - - static void writeTo(CodedOutputStream output, Metadata metadata, K key, V value) - throws IOException { - FieldSet.writeElement(output, metadata.keyType, KEY_FIELD_NUMBER, key); - FieldSet.writeElement(output, metadata.valueType, VALUE_FIELD_NUMBER, value); - } - - static int computeSerializedSize(Metadata metadata, K key, V value) { - return FieldSet.computeElementSize(metadata.keyType, KEY_FIELD_NUMBER, key) - + FieldSet.computeElementSize(metadata.valueType, VALUE_FIELD_NUMBER, value); - } - - @SuppressWarnings("unchecked") - static T parseField( - CodedInputStream input, ExtensionRegistryLite extensionRegistry, - WireFormat.FieldType type, T value) throws IOException { - switch (type) { - case MESSAGE: - MessageLite.Builder subBuilder = ((MessageLite) value).toBuilder(); - input.readMessage(subBuilder, extensionRegistry); - return (T) subBuilder.buildPartial(); - case ENUM: - return (T) (java.lang.Integer) input.readEnum(); - case GROUP: - throw new RuntimeException("Groups are not allowed in maps."); - default: - return (T) FieldSet.readPrimitiveField(input, type, true); - } - } - - /** - * Serializes the provided key and value as though they were wrapped by a {@link MapEntryLite} - * to the output stream. This helper method avoids allocation of a {@link MapEntryLite} - * built with a key and value and is called from generated code directly. - */ - public void serializeTo(CodedOutputStream output, int fieldNumber, K key, V value) - throws IOException { - output.writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED); - output.writeUInt32NoTag(computeSerializedSize(metadata, key, value)); - writeTo(output, metadata, key, value); - } - - /** - * Computes the message size for the provided key and value as though they were wrapped - * by a {@link MapEntryLite}. This helper method avoids allocation of a {@link MapEntryLite} - * built with a key and value and is called from generated code directly. - */ - public int computeMessageSize(int fieldNumber, K key, V value) { - return CodedOutputStream.computeTagSize(fieldNumber) - + CodedOutputStream.computeLengthDelimitedFieldSize( - computeSerializedSize(metadata, key, value)); - } - - /** - * Parses an entry off of the input as a {@link Map.Entry}. This helper requires an allocation - * so using {@link #parseInto} is preferred if possible. - */ - public Map.Entry parseEntry(ByteString bytes, ExtensionRegistryLite extensionRegistry) - throws IOException { - return parseEntry(bytes.newCodedInput(), metadata, extensionRegistry); - } - - static Map.Entry parseEntry( - CodedInputStream input, Metadata metadata, ExtensionRegistryLite extensionRegistry) - throws IOException{ - K key = metadata.defaultKey; - V value = metadata.defaultValue; - while (true) { - int tag = input.readTag(); - if (tag == 0) { - break; - } - if (tag == WireFormat.makeTag(KEY_FIELD_NUMBER, metadata.keyType.getWireType())) { - key = parseField(input, extensionRegistry, metadata.keyType, key); - } else if (tag == WireFormat.makeTag(VALUE_FIELD_NUMBER, metadata.valueType.getWireType())) { - value = parseField(input, extensionRegistry, metadata.valueType, value); - } else { - if (!input.skipField(tag)) { - break; - } - } - } - return new AbstractMap.SimpleImmutableEntry(key, value); - } - - /** - * Parses an entry off of the input into the map. This helper avoids allocaton of a - * {@link MapEntryLite} by parsing directly into the provided {@link MapFieldLite}. - */ - public void parseInto( - MapFieldLite map, CodedInputStream input, ExtensionRegistryLite extensionRegistry) - throws IOException { - int length = input.readRawVarint32(); - final int oldLimit = input.pushLimit(length); - K key = metadata.defaultKey; - V value = metadata.defaultValue; - - while (true) { - int tag = input.readTag(); - if (tag == 0) { - break; - } - if (tag == WireFormat.makeTag(KEY_FIELD_NUMBER, metadata.keyType.getWireType())) { - key = parseField(input, extensionRegistry, metadata.keyType, key); - } else if (tag == WireFormat.makeTag(VALUE_FIELD_NUMBER, metadata.valueType.getWireType())) { - value = parseField(input, extensionRegistry, metadata.valueType, value); - } else { - if (!input.skipField(tag)) { - break; - } - } - } - - input.checkLastTagWas(0); - input.popLimit(oldLimit); - map.put(key, value); - } -} http://git-wip-us.apache.org/repos/asf/hbase/blob/ee70b1d2/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapField.java ---------------------------------------------------------------------- diff --git a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapField.java b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapField.java deleted file mode 100644 index 42905d2..0000000 --- a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapField.java +++ /dev/null @@ -1,624 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.hadoop.hbase.shaded.com.google.protobuf; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Internal representation of map fields in generated messages. - * - * This class supports accessing the map field as a {@link Map} to be used in - * generated API and also supports accessing the field as a {@link List} to be - * used in reflection API. It keeps track of where the data is currently stored - * and do necessary conversions between map and list. - * - * This class is a protobuf implementation detail. Users shouldn't use this - * class directly. - * - * THREAD-SAFETY NOTE: Read-only access is thread-safe. Users can call getMap() - * and getList() concurrently in multiple threads. If write-access is needed, - * all access must be synchronized. - */ -public class MapField implements MutabilityOracle { - /** - * Indicates where the data of this map field is currently stored. - * - * MAP: Data is stored in mapData. - * LIST: Data is stored in listData. - * BOTH: mapData and listData have the same data. - * - * When the map field is accessed (through generated API or reflection API), - * it will shift between these 3 modes: - * - * getMap() getList() getMutableMap() getMutableList() - * MAP MAP BOTH MAP LIST - * LIST BOTH LIST MAP LIST - * BOTH BOTH BOTH MAP LIST - * - * As the map field changes its mode, the list/map reference returned in a - * previous method call may be invalidated. - */ - private enum StorageMode {MAP, LIST, BOTH} - - private volatile boolean isMutable; - private volatile StorageMode mode; - private MutatabilityAwareMap mapData; - private List listData; - - // Convert between a map entry Message and a key-value pair. - private static interface Converter { - Message convertKeyAndValueToMessage(K key, V value); - void convertMessageToKeyAndValue(Message message, Map map); - - Message getMessageDefaultInstance(); - } - - private static class ImmutableMessageConverter implements Converter { - private final MapEntry defaultEntry; - public ImmutableMessageConverter(MapEntry defaultEntry) { - this.defaultEntry = defaultEntry; - } - - @Override - public Message convertKeyAndValueToMessage(K key, V value) { - return defaultEntry.newBuilderForType().setKey(key).setValue(value).buildPartial(); - } - - @Override - public void convertMessageToKeyAndValue(Message message, Map map) { - MapEntry entry = (MapEntry) message; - map.put(entry.getKey(), entry.getValue()); - } - - @Override - public Message getMessageDefaultInstance() { - return defaultEntry; - } - } - - - private final Converter converter; - - private MapField( - Converter converter, - StorageMode mode, - Map mapData) { - this.converter = converter; - this.isMutable = true; - this.mode = mode; - this.mapData = new MutatabilityAwareMap(this, mapData); - this.listData = null; - } - - private MapField( - MapEntry defaultEntry, - StorageMode mode, - Map mapData) { - this(new ImmutableMessageConverter(defaultEntry), mode, mapData); - } - - - /** Returns an immutable empty MapField. */ - public static MapField emptyMapField( - MapEntry defaultEntry) { - return new MapField( - defaultEntry, StorageMode.MAP, Collections.emptyMap()); - } - - - /** Creates a new mutable empty MapField. */ - public static MapField newMapField(MapEntry defaultEntry) { - return new MapField( - defaultEntry, StorageMode.MAP, new LinkedHashMap()); - } - - - private Message convertKeyAndValueToMessage(K key, V value) { - return converter.convertKeyAndValueToMessage(key, value); - } - - @SuppressWarnings("unchecked") - private void convertMessageToKeyAndValue(Message message, Map map) { - converter.convertMessageToKeyAndValue(message, map); - } - - private List convertMapToList(MutatabilityAwareMap mapData) { - List listData = new ArrayList(); - for (Map.Entry entry : mapData.entrySet()) { - listData.add( - convertKeyAndValueToMessage( - entry.getKey(), entry.getValue())); - } - return listData; - } - - private MutatabilityAwareMap convertListToMap(List listData) { - Map mapData = new LinkedHashMap(); - for (Message item : listData) { - convertMessageToKeyAndValue(item, mapData); - } - return new MutatabilityAwareMap(this, mapData); - } - - /** Returns the content of this MapField as a read-only Map. */ - public Map getMap() { - if (mode == StorageMode.LIST) { - synchronized (this) { - if (mode == StorageMode.LIST) { - mapData = convertListToMap(listData); - mode = StorageMode.BOTH; - } - } - } - return Collections.unmodifiableMap(mapData); - } - - /** Gets a mutable Map view of this MapField. */ - public Map getMutableMap() { - if (mode != StorageMode.MAP) { - if (mode == StorageMode.LIST) { - mapData = convertListToMap(listData); - } - listData = null; - mode = StorageMode.MAP; - } - return mapData; - } - - public void mergeFrom(MapField other) { - getMutableMap().putAll(MapFieldLite.copy(other.getMap())); - } - - public void clear() { - mapData = new MutatabilityAwareMap(this, new LinkedHashMap()); - mode = StorageMode.MAP; - } - - @SuppressWarnings("unchecked") - @Override - public boolean equals(Object object) { - if (!(object instanceof MapField)) { - return false; - } - MapField other = (MapField) object; - return MapFieldLite.equals(getMap(), other.getMap()); - } - - @Override - public int hashCode() { - return MapFieldLite.calculateHashCodeForMap(getMap()); - } - - /** Returns a deep copy of this MapField. */ - public MapField copy() { - return new MapField( - converter, StorageMode.MAP, MapFieldLite.copy(getMap())); - } - - /** Gets the content of this MapField as a read-only List. */ - List getList() { - if (mode == StorageMode.MAP) { - synchronized (this) { - if (mode == StorageMode.MAP) { - listData = convertMapToList(mapData); - mode = StorageMode.BOTH; - } - } - } - return Collections.unmodifiableList(listData); - } - - /** Gets a mutable List view of this MapField. */ - List getMutableList() { - if (mode != StorageMode.LIST) { - if (mode == StorageMode.MAP) { - listData = convertMapToList(mapData); - } - mapData = null; - mode = StorageMode.LIST; - } - return listData; - } - - /** - * Gets the default instance of the message stored in the list view of this - * map field. - */ - Message getMapEntryMessageDefaultInstance() { - return converter.getMessageDefaultInstance(); - } - - /** - * Makes this list immutable. All subsequent modifications will throw an - * {@link UnsupportedOperationException}. - */ - public void makeImmutable() { - isMutable = false; - } - - /** - * Returns whether this field can be modified. - */ - public boolean isMutable() { - return isMutable; - } - - /* (non-Javadoc) - * @see org.apache.hadoop.hbase.shaded.com.google.protobuf.MutabilityOracle#ensureMutable() - */ - @Override - public void ensureMutable() { - if (!isMutable()) { - throw new UnsupportedOperationException(); - } - } - - /** - * An internal map that checks for mutability before delegating. - */ - private static class MutatabilityAwareMap implements Map { - private final MutabilityOracle mutabilityOracle; - private final Map delegate; - - MutatabilityAwareMap(MutabilityOracle mutabilityOracle, Map delegate) { - this.mutabilityOracle = mutabilityOracle; - this.delegate = delegate; - } - - @Override - public int size() { - return delegate.size(); - } - - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - @Override - public boolean containsKey(Object key) { - return delegate.containsKey(key); - } - - @Override - public boolean containsValue(Object value) { - return delegate.containsValue(value); - } - - @Override - public V get(Object key) { - return delegate.get(key); - } - - @Override - public V put(K key, V value) { - mutabilityOracle.ensureMutable(); - return delegate.put(key, value); - } - - @Override - public V remove(Object key) { - mutabilityOracle.ensureMutable(); - return delegate.remove(key); - } - - @Override - public void putAll(Map m) { - mutabilityOracle.ensureMutable(); - delegate.putAll(m); - } - - @Override - public void clear() { - mutabilityOracle.ensureMutable(); - delegate.clear(); - } - - @Override - public Set keySet() { - return new MutatabilityAwareSet(mutabilityOracle, delegate.keySet()); - } - - @Override - public Collection values() { - return new MutatabilityAwareCollection(mutabilityOracle, delegate.values()); - } - - @Override - public Set> entrySet() { - return new MutatabilityAwareSet>(mutabilityOracle, delegate.entrySet()); - } - - @Override - public boolean equals(Object o) { - return delegate.equals(o); - } - - @Override - public int hashCode() { - return delegate.hashCode(); - } - - @Override - public String toString() { - return delegate.toString(); - } - - /** - * An internal collection that checks for mutability before delegating. - */ - private static class MutatabilityAwareCollection implements Collection { - private final MutabilityOracle mutabilityOracle; - private final Collection delegate; - - MutatabilityAwareCollection(MutabilityOracle mutabilityOracle, Collection delegate) { - this.mutabilityOracle = mutabilityOracle; - this.delegate = delegate; - } - - @Override - public int size() { - return delegate.size(); - } - - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - @Override - public boolean contains(Object o) { - return delegate.contains(o); - } - - @Override - public Iterator iterator() { - return new MutatabilityAwareIterator(mutabilityOracle, delegate.iterator()); - } - - @Override - public Object[] toArray() { - return delegate.toArray(); - } - - @Override - public T[] toArray(T[] a) { - return delegate.toArray(a); - } - - @Override - public boolean add(E e) { - // Unsupported operation in the delegate. - throw new UnsupportedOperationException(); - } - - @Override - public boolean remove(Object o) { - mutabilityOracle.ensureMutable(); - return delegate.remove(o); - } - - @Override - public boolean containsAll(Collection c) { - return delegate.containsAll(c); - } - - @Override - public boolean addAll(Collection c) { - // Unsupported operation in the delegate. - throw new UnsupportedOperationException(); - } - - @Override - public boolean removeAll(Collection c) { - mutabilityOracle.ensureMutable(); - return delegate.removeAll(c); - } - - @Override - public boolean retainAll(Collection c) { - mutabilityOracle.ensureMutable(); - return delegate.retainAll(c); - } - - @Override - public void clear() { - mutabilityOracle.ensureMutable(); - delegate.clear(); - } - - @Override - public boolean equals(Object o) { - return delegate.equals(o); - } - - @Override - public int hashCode() { - return delegate.hashCode(); - } - - @Override - public String toString() { - return delegate.toString(); - } - } - - /** - * An internal set that checks for mutability before delegating. - */ - private static class MutatabilityAwareSet implements Set { - private final MutabilityOracle mutabilityOracle; - private final Set delegate; - - MutatabilityAwareSet(MutabilityOracle mutabilityOracle, Set delegate) { - this.mutabilityOracle = mutabilityOracle; - this.delegate = delegate; - } - - @Override - public int size() { - return delegate.size(); - } - - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - @Override - public boolean contains(Object o) { - return delegate.contains(o); - } - - @Override - public Iterator iterator() { - return new MutatabilityAwareIterator(mutabilityOracle, delegate.iterator()); - } - - @Override - public Object[] toArray() { - return delegate.toArray(); - } - - @Override - public T[] toArray(T[] a) { - return delegate.toArray(a); - } - - @Override - public boolean add(E e) { - mutabilityOracle.ensureMutable(); - return delegate.add(e); - } - - @Override - public boolean remove(Object o) { - mutabilityOracle.ensureMutable(); - return delegate.remove(o); - } - - @Override - public boolean containsAll(Collection c) { - return delegate.containsAll(c); - } - - @Override - public boolean addAll(Collection c) { - mutabilityOracle.ensureMutable(); - return delegate.addAll(c); - } - - @Override - public boolean retainAll(Collection c) { - mutabilityOracle.ensureMutable(); - return delegate.retainAll(c); - } - - @Override - public boolean removeAll(Collection c) { - mutabilityOracle.ensureMutable(); - return delegate.removeAll(c); - } - - @Override - public void clear() { - mutabilityOracle.ensureMutable(); - delegate.clear(); - } - - @Override - public boolean equals(Object o) { - return delegate.equals(o); - } - - @Override - public int hashCode() { - return delegate.hashCode(); - } - - @Override - public String toString() { - return delegate.toString(); - } - } - - /** - * An internal iterator that checks for mutability before delegating. - */ - private static class MutatabilityAwareIterator implements Iterator { - private final MutabilityOracle mutabilityOracle; - private final Iterator delegate; - - MutatabilityAwareIterator(MutabilityOracle mutabilityOracle, Iterator delegate) { - this.mutabilityOracle = mutabilityOracle; - this.delegate = delegate; - } - - @Override - public boolean hasNext() { - return delegate.hasNext(); - } - - @Override - public E next() { - return delegate.next(); - } - - @Override - public void remove() { - mutabilityOracle.ensureMutable(); - delegate.remove(); - } - - @Override - public boolean equals(Object obj) { - return delegate.equals(obj); - } - - @Override - public int hashCode() { - return delegate.hashCode(); - } - - @Override - public String toString() { - return delegate.toString(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/hbase/blob/ee70b1d2/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapFieldLite.java ---------------------------------------------------------------------- diff --git a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapFieldLite.java b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapFieldLite.java deleted file mode 100644 index 761c4ce..0000000 --- a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MapFieldLite.java +++ /dev/null @@ -1,224 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.hadoop.hbase.shaded.com.google.protobuf; - -import org.apache.hadoop.hbase.shaded.com.google.protobuf.Internal.EnumLite; - -import java.util.Arrays; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; - -/** - * Internal representation of map fields in generated lite-runtime messages. - * - * This class is a protobuf implementation detail. Users shouldn't use this - * class directly. - */ -public final class MapFieldLite extends LinkedHashMap { - - private boolean isMutable; - - private MapFieldLite() { - this.isMutable = true; - } - - private MapFieldLite(Map mapData) { - super(mapData); - this.isMutable = true; - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - private static final MapFieldLite EMPTY_MAP_FIELD = new MapFieldLite(); - static { - EMPTY_MAP_FIELD.makeImmutable(); - } - - /** Returns an singleton immutable empty MapFieldLite instance. */ - @SuppressWarnings({"unchecked", "cast"}) - public static MapFieldLite emptyMapField() { - return (MapFieldLite) EMPTY_MAP_FIELD; - } - - public void mergeFrom(MapFieldLite other) { - ensureMutable(); - if (!other.isEmpty()) { - putAll(other); - } - } - - @SuppressWarnings({"unchecked", "cast"}) - @Override public Set> entrySet() { - return isEmpty() ? Collections.>emptySet() : super.entrySet(); - } - - @Override public void clear() { - ensureMutable(); - super.clear(); - } - - @Override public V put(K key, V value) { - ensureMutable(); - return super.put(key, value); - } - - public V put(Map.Entry entry) { - return put(entry.getKey(), entry.getValue()); - } - - @Override public void putAll(Map m) { - ensureMutable(); - super.putAll(m); - } - - @Override public V remove(Object key) { - ensureMutable(); - return super.remove(key); - } - - private static boolean equals(Object a, Object b) { - if (a instanceof byte[] && b instanceof byte[]) { - return Arrays.equals((byte[]) a, (byte[]) b); - } - return a.equals(b); - } - - /** - * Checks whether two {@link Map}s are equal. We don't use the default equals - * method of {@link Map} because it compares by identity not by content for - * byte arrays. - */ - static boolean equals(Map a, Map b) { - if (a == b) { - return true; - } - if (a.size() != b.size()) { - return false; - } - for (Map.Entry entry : a.entrySet()) { - if (!b.containsKey(entry.getKey())) { - return false; - } - if (!equals(entry.getValue(), b.get(entry.getKey()))) { - return false; - } - } - return true; - } - - /** - * Checks whether two map fields are equal. - */ - @SuppressWarnings("unchecked") - @Override - public boolean equals(Object object) { - return (object instanceof Map) && equals(this, (Map) object); - } - - private static int calculateHashCodeForObject(Object a) { - if (a instanceof byte[]) { - return Internal.hashCode((byte[]) a); - } - // Enums should be stored as integers internally. - if (a instanceof EnumLite) { - throw new UnsupportedOperationException(); - } - return a.hashCode(); - } - - /** - * Calculates the hash code for a {@link Map}. We don't use the default hash - * code method of {@link Map} because for byte arrays and protobuf enums it - * use {@link Object#hashCode()}. - */ - static int calculateHashCodeForMap(Map a) { - int result = 0; - for (Map.Entry entry : a.entrySet()) { - result += calculateHashCodeForObject(entry.getKey()) - ^ calculateHashCodeForObject(entry.getValue()); - } - return result; - } - - @Override - public int hashCode() { - return calculateHashCodeForMap(this); - } - - private static Object copy(Object object) { - if (object instanceof byte[]) { - byte[] data = (byte[]) object; - return Arrays.copyOf(data, data.length); - } - return object; - } - - /** - * Makes a deep copy of a {@link Map}. Immutable objects in the map will be - * shared (e.g., integers, strings, immutable messages) and mutable ones will - * have a copy (e.g., byte arrays, mutable messages). - */ - @SuppressWarnings("unchecked") - static Map copy(Map map) { - Map result = new LinkedHashMap(); - for (Map.Entry entry : map.entrySet()) { - result.put(entry.getKey(), (V) copy(entry.getValue())); - } - return result; - } - - /** Returns a deep copy of this map field. */ - public MapFieldLite mutableCopy() { - return isEmpty() ? new MapFieldLite() : new MapFieldLite(this); - } - - /** - * Makes this field immutable. All subsequent modifications will throw an - * {@link UnsupportedOperationException}. - */ - public void makeImmutable() { - isMutable = false; - } - - /** - * Returns whether this field can be modified. - */ - public boolean isMutable() { - return isMutable; - } - - private void ensureMutable() { - if (!isMutable()) { - throw new UnsupportedOperationException(); - } - } -} http://git-wip-us.apache.org/repos/asf/hbase/blob/ee70b1d2/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/Message.java ---------------------------------------------------------------------- diff --git a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/Message.java b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/Message.java deleted file mode 100644 index e85079d..0000000 --- a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/Message.java +++ /dev/null @@ -1,292 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// TODO(kenton): Use generics? E.g. Builder, then -// mergeFrom*() could return BuilderType for better type-safety. - -package org.apache.hadoop.hbase.shaded.com.google.protobuf; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; - -/** - * Abstract interface implemented by Protocol Message objects. - *

- * See also {@link MessageLite}, which defines most of the methods that typical - * users care about. {@link Message} adds to it methods that are not available - * in the "lite" runtime. The biggest added features are introspection and - * reflection -- i.e., getting descriptors for the message type and accessing - * the field values dynamically. - * - * @author kenton@google.com Kenton Varda - */ -public interface Message extends MessageLite, MessageOrBuilder { - - // (From MessageLite, re-declared here only for return type covariance.) - @Override - Parser getParserForType(); - - - // ----------------------------------------------------------------- - // Comparison and hashing - - /** - * Compares the specified object with this message for equality. Returns - * {@code true} if the given object is a message of the same type (as - * defined by {@code getDescriptorForType()}) and has identical values for - * all of its fields. Subclasses must implement this; inheriting - * {@code Object.equals()} is incorrect. - * - * @param other object to be compared for equality with this message - * @return {@code true} if the specified object is equal to this message - */ - @Override - boolean equals(Object other); - - /** - * Returns the hash code value for this message. The hash code of a message - * should mix the message's type (object identity of the descriptor) with its - * contents (known and unknown field values). Subclasses must implement this; - * inheriting {@code Object.hashCode()} is incorrect. - * - * @return the hash code value for this message - * @see Map#hashCode() - */ - @Override - int hashCode(); - - // ----------------------------------------------------------------- - // Convenience methods. - - /** - * Converts the message to a string in protocol buffer text format. This is - * just a trivial wrapper around {@link - * TextFormat#printToString(MessageOrBuilder)}. - */ - @Override - String toString(); - - // ================================================================= - // Builders - - // (From MessageLite, re-declared here only for return type covariance.) - @Override - Builder newBuilderForType(); - - @Override - Builder toBuilder(); - - /** - * Abstract interface implemented by Protocol Message builders. - */ - interface Builder extends MessageLite.Builder, MessageOrBuilder { - // (From MessageLite.Builder, re-declared here only for return type - // covariance.) - @Override - Builder clear(); - - /** - * Merge {@code other} into the message being built. {@code other} must - * have the exact same type as {@code this} (i.e. - * {@code getDescriptorForType() == other.getDescriptorForType()}). - * - * Merging occurs as follows. For each field:
- * * For singular primitive fields, if the field is set in {@code other}, - * then {@code other}'s value overwrites the value in this message.
- * * For singular message fields, if the field is set in {@code other}, - * it is merged into the corresponding sub-message of this message - * using the same merging rules.
- * * For repeated fields, the elements in {@code other} are concatenated - * with the elements in this message. - * * For oneof groups, if the other message has one of the fields set, - * the group of this message is cleared and replaced by the field - * of the other message, so that the oneof constraint is preserved. - * - * This is equivalent to the {@code Message::MergeFrom} method in C++. - */ - Builder mergeFrom(Message other); - - // (From MessageLite.Builder, re-declared here only for return type - // covariance.) - @Override - Message build(); - - @Override - Message buildPartial(); - - @Override - Builder clone(); - - @Override - Builder mergeFrom(CodedInputStream input) throws IOException; - - @Override - Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) - throws IOException; - - /** - * Get the message's type's descriptor. - * See {@link Message#getDescriptorForType()}. - */ - @Override - Descriptors.Descriptor getDescriptorForType(); - - /** - * Create a Builder for messages of the appropriate type for the given - * field. Messages built with this can then be passed to setField(), - * setRepeatedField(), or addRepeatedField(). - */ - Builder newBuilderForField(Descriptors.FieldDescriptor field); - - /** - * Get a nested builder instance for the given field. - *

- * Normally, we hold a reference to the immutable message object for the - * message type field. Some implementations(the generated message builders), - * however, can also hold a reference to the builder object (a nested - * builder) for the field. - *

- * If the field is already backed up by a nested builder, the nested builder - * will be returned. Otherwise, a new field builder will be created and - * returned. The original message field (if exist) will be merged into the - * field builder, which will then be nested into its parent builder. - *

- * NOTE: implementations that do not support nested builders will throw - * UnsupportedOperationException. - */ - Builder getFieldBuilder(Descriptors.FieldDescriptor field); - - /** - * Get a nested builder instance for the given repeated field instance. - *

- * Normally, we hold a reference to the immutable message object for the - * message type field. Some implementations(the generated message builders), - * however, can also hold a reference to the builder object (a nested - * builder) for the field. - *

- * If the field is already backed up by a nested builder, the nested builder - * will be returned. Otherwise, a new field builder will be created and - * returned. The original message field (if exist) will be merged into the - * field builder, which will then be nested into its parent builder. - *

- * NOTE: implementations that do not support nested builders will throw - * UnsupportedOperationException. - */ - Builder getRepeatedFieldBuilder(Descriptors.FieldDescriptor field, - int index); - - /** - * Sets a field to the given value. The value must be of the correct type - * for this field, i.e. the same type that - * {@link Message#getField(Descriptors.FieldDescriptor)} would return. - */ - Builder setField(Descriptors.FieldDescriptor field, Object value); - - /** - * Clears the field. This is exactly equivalent to calling the generated - * "clear" accessor method corresponding to the field. - */ - Builder clearField(Descriptors.FieldDescriptor field); - - /** - * Clears the oneof. This is exactly equivalent to calling the generated - * "clear" accessor method corresponding to the oneof. - */ - Builder clearOneof(Descriptors.OneofDescriptor oneof); - - /** - * Sets an element of a repeated field to the given value. The value must - * be of the correct type for this field, i.e. the same type that - * {@link Message#getRepeatedField(Descriptors.FieldDescriptor,int)} would - * return. - * @throws IllegalArgumentException The field is not a repeated field, or - * {@code field.getContainingType() != getDescriptorForType()}. - */ - Builder setRepeatedField(Descriptors.FieldDescriptor field, - int index, Object value); - - /** - * Like {@code setRepeatedField}, but appends the value as a new element. - * @throws IllegalArgumentException The field is not a repeated field, or - * {@code field.getContainingType() != getDescriptorForType()}. - */ - Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value); - - /** Set the {@link UnknownFieldSet} for this message. */ - Builder setUnknownFields(UnknownFieldSet unknownFields); - - /** - * Merge some unknown fields into the {@link UnknownFieldSet} for this - * message. - */ - Builder mergeUnknownFields(UnknownFieldSet unknownFields); - - // --------------------------------------------------------------- - // Convenience methods. - - // (From MessageLite.Builder, re-declared here only for return type - // covariance.) - @Override - Builder mergeFrom(ByteString data) throws InvalidProtocolBufferException; - - @Override - Builder mergeFrom(ByteString data, ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException; - - @Override - Builder mergeFrom(byte[] data) throws InvalidProtocolBufferException; - - @Override - Builder mergeFrom(byte[] data, int off, int len) throws InvalidProtocolBufferException; - - @Override - Builder mergeFrom(byte[] data, ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException; - - @Override - Builder mergeFrom(byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException; - - @Override - Builder mergeFrom(InputStream input) throws IOException; - - @Override - Builder mergeFrom(InputStream input, ExtensionRegistryLite extensionRegistry) - throws IOException; - - @Override - boolean mergeDelimitedFrom(InputStream input) throws IOException; - - @Override - boolean mergeDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry) - throws IOException; - } -} http://git-wip-us.apache.org/repos/asf/hbase/blob/ee70b1d2/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MessageLite.java ---------------------------------------------------------------------- diff --git a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MessageLite.java b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MessageLite.java deleted file mode 100644 index 8340abab..0000000 --- a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MessageLite.java +++ /dev/null @@ -1,341 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// TODO(kenton): Use generics? E.g. Builder, then -// mergeFrom*() could return BuilderType for better type-safety. - -package org.apache.hadoop.hbase.shaded.com.google.protobuf; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -/** - * Abstract interface implemented by Protocol Message objects. - * - *

This interface is implemented by all protocol message objects. Non-lite - * messages additionally implement the Message interface, which is a subclass - * of MessageLite. Use MessageLite instead when you only need the subset of - * features which it supports -- namely, nothing that uses descriptors or - * reflection. You can instruct the protocol compiler to generate classes - * which implement only MessageLite, not the full Message interface, by adding - * the follow line to the .proto file: - *

- *   option optimize_for = LITE_RUNTIME;
- * 
- * - *

This is particularly useful on resource-constrained systems where the - * full protocol buffers runtime library is too big. - * - *

Note that on non-constrained systems (e.g. servers) when you need to link - * in lots of protocol definitions, a better way to reduce total code footprint - * is to use {@code optimize_for = CODE_SIZE}. This will make the generated - * code smaller while still supporting all the same features (at the expense of - * speed). {@code optimize_for = LITE_RUNTIME} is best when you only have a - * small number of message types linked into your binary, in which case the - * size of the protocol buffers runtime itself is the biggest problem. - * - * @author kenton@google.com Kenton Varda - */ -public interface MessageLite extends MessageLiteOrBuilder { - - - /** - * Serializes the message and writes it to {@code output}. This does not - * flush or close the stream. - */ - void writeTo(CodedOutputStream output) throws IOException; - - /** - * Get the number of bytes required to encode this message. The result - * is only computed on the first call and memoized after that. - */ - int getSerializedSize(); - - - /** - * Gets the parser for a message of the same type as this message. - */ - Parser getParserForType(); - - // ----------------------------------------------------------------- - // Convenience methods. - - /** - * Serializes the message to a {@code ByteString} and returns it. This is - * just a trivial wrapper around - * {@link #writeTo(CodedOutputStream)}. - */ - ByteString toByteString(); - - /** - * Serializes the message to a {@code byte} array and returns it. This is - * just a trivial wrapper around - * {@link #writeTo(CodedOutputStream)}. - */ - byte[] toByteArray(); - - /** - * Serializes the message and writes it to {@code output}. This is just a - * trivial wrapper around {@link #writeTo(CodedOutputStream)}. This does - * not flush or close the stream. - *

- * NOTE: Protocol Buffers are not self-delimiting. Therefore, if you write - * any more data to the stream after the message, you must somehow ensure - * that the parser on the receiving end does not interpret this as being - * part of the protocol message. This can be done e.g. by writing the size - * of the message before the data, then making sure to limit the input to - * that size on the receiving end (e.g. by wrapping the InputStream in one - * which limits the input). Alternatively, just use - * {@link #writeDelimitedTo(OutputStream)}. - */ - void writeTo(OutputStream output) throws IOException; - - /** - * Like {@link #writeTo(OutputStream)}, but writes the size of the message - * as a varint before writing the data. This allows more data to be written - * to the stream after the message without the need to delimit the message - * data yourself. Use {@link Builder#mergeDelimitedFrom(InputStream)} (or - * the static method {@code YourMessageType.parseDelimitedFrom(InputStream)}) - * to parse messages written by this method. - */ - void writeDelimitedTo(OutputStream output) throws IOException; - - - // ================================================================= - // Builders - - /** - * Constructs a new builder for a message of the same type as this message. - */ - Builder newBuilderForType(); - - /** - * Constructs a builder initialized with the current message. Use this to - * derive a new message from the current one. - */ - Builder toBuilder(); - - /** - * Abstract interface implemented by Protocol Message builders. - */ - interface Builder extends MessageLiteOrBuilder, Cloneable { - /** Resets all fields to their default values. */ - Builder clear(); - - /** - * Constructs the message based on the state of the Builder. Subsequent - * changes to the Builder will not affect the returned message. - * @throws UninitializedMessageException The message is missing one or more - * required fields (i.e. {@link #isInitialized()} returns false). - * Use {@link #buildPartial()} to bypass this check. - */ - MessageLite build(); - - /** - * Like {@link #build()}, but does not throw an exception if the message - * is missing required fields. Instead, a partial message is returned. - * Subsequent changes to the Builder will not affect the returned message. - */ - MessageLite buildPartial(); - - /** - * Clones the Builder. - * @see Object#clone() - */ - Builder clone(); - - /** - * Parses a message of this type from the input and merges it with this - * message. - * - *

Warning: This does not verify that all required fields are present in - * the input message. If you call {@link #build()} without setting all - * required fields, it will throw an {@link UninitializedMessageException}, - * which is a {@code RuntimeException} and thus might not be caught. There - * are a few good ways to deal with this: - *

    - *
  • Call {@link #isInitialized()} to verify that all required fields - * are set before building. - *
  • Use {@code buildPartial()} to build, which ignores missing - * required fields. - *
- * - *

Note: The caller should call - * {@link CodedInputStream#checkLastTagWas(int)} after calling this to - * verify that the last tag seen was the appropriate end-group tag, - * or zero for EOF. - */ - Builder mergeFrom(CodedInputStream input) throws IOException; - - /** - * Like {@link Builder#mergeFrom(CodedInputStream)}, but also - * parses extensions. The extensions that you want to be able to parse - * must be registered in {@code extensionRegistry}. Extensions not in - * the registry will be treated as unknown fields. - */ - Builder mergeFrom(CodedInputStream input, - ExtensionRegistryLite extensionRegistry) - throws IOException; - - // --------------------------------------------------------------- - // Convenience methods. - - /** - * Parse {@code data} as a message of this type and merge it with the - * message being built. This is just a small wrapper around - * {@link #mergeFrom(CodedInputStream)}. - * - * @return this - */ - Builder mergeFrom(ByteString data) throws InvalidProtocolBufferException; - - /** - * Parse {@code data} as a message of this type and merge it with the - * message being built. This is just a small wrapper around - * {@link #mergeFrom(CodedInputStream,ExtensionRegistryLite)}. - * - * @return this - */ - Builder mergeFrom(ByteString data, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException; - - /** - * Parse {@code data} as a message of this type and merge it with the - * message being built. This is just a small wrapper around - * {@link #mergeFrom(CodedInputStream)}. - * - * @return this - */ - Builder mergeFrom(byte[] data) throws InvalidProtocolBufferException; - - /** - * Parse {@code data} as a message of this type and merge it with the - * message being built. This is just a small wrapper around - * {@link #mergeFrom(CodedInputStream)}. - * - * @return this - */ - Builder mergeFrom(byte[] data, int off, int len) - throws InvalidProtocolBufferException; - - /** - * Parse {@code data} as a message of this type and merge it with the - * message being built. This is just a small wrapper around - * {@link #mergeFrom(CodedInputStream,ExtensionRegistryLite)}. - * - * @return this - */ - Builder mergeFrom(byte[] data, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException; - - /** - * Parse {@code data} as a message of this type and merge it with the - * message being built. This is just a small wrapper around - * {@link #mergeFrom(CodedInputStream,ExtensionRegistryLite)}. - * - * @return this - */ - Builder mergeFrom(byte[] data, int off, int len, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException; - - /** - * Parse a message of this type from {@code input} and merge it with the - * message being built. This is just a small wrapper around - * {@link #mergeFrom(CodedInputStream)}. Note that this method always - * reads the entire input (unless it throws an exception). If you - * want it to stop earlier, you will need to wrap your input in some - * wrapper stream that limits reading. Or, use - * {@link MessageLite#writeDelimitedTo(OutputStream)} to write your message - * and {@link #mergeDelimitedFrom(InputStream)} to read it. - *

- * Despite usually reading the entire input, this does not close the stream. - * - * @return this - */ - Builder mergeFrom(InputStream input) throws IOException; - - /** - * Parse a message of this type from {@code input} and merge it with the - * message being built. This is just a small wrapper around - * {@link #mergeFrom(CodedInputStream,ExtensionRegistryLite)}. - * - * @return this - */ - Builder mergeFrom(InputStream input, - ExtensionRegistryLite extensionRegistry) - throws IOException; - - /** - * Merge {@code other} into the message being built. {@code other} must - * have the exact same type as {@code this} (i.e. - * {@code getClass().equals(getDefaultInstanceForType().getClass())}). - * - * Merging occurs as follows. For each field:
- * * For singular primitive fields, if the field is set in {@code other}, - * then {@code other}'s value overwrites the value in this message.
- * * For singular message fields, if the field is set in {@code other}, - * it is merged into the corresponding sub-message of this message - * using the same merging rules.
- * * For repeated fields, the elements in {@code other} are concatenated - * with the elements in this message. - * * For oneof groups, if the other message has one of the fields set, - * the group of this message is cleared and replaced by the field - * of the other message, so that the oneof constraint is preserved. - * - * This is equivalent to the {@code Message::MergeFrom} method in C++. - */ - Builder mergeFrom(MessageLite other); - - /** - * Like {@link #mergeFrom(InputStream)}, but does not read until EOF. - * Instead, the size of the message (encoded as a varint) is read first, - * then the message data. Use - * {@link MessageLite#writeDelimitedTo(OutputStream)} to write messages in - * this format. - * - * @return True if successful, or false if the stream is at EOF when the - * method starts. Any other error (including reaching EOF during - * parsing) will cause an exception to be thrown. - */ - boolean mergeDelimitedFrom(InputStream input) - throws IOException; - - /** - * Like {@link #mergeDelimitedFrom(InputStream)} but supporting extensions. - */ - boolean mergeDelimitedFrom(InputStream input, - ExtensionRegistryLite extensionRegistry) - throws IOException; - } -} http://git-wip-us.apache.org/repos/asf/hbase/blob/ee70b1d2/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MessageLiteOrBuilder.java ---------------------------------------------------------------------- diff --git a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MessageLiteOrBuilder.java b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MessageLiteOrBuilder.java deleted file mode 100644 index 39f144d..0000000 --- a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/MessageLiteOrBuilder.java +++ /dev/null @@ -1,60 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.hadoop.hbase.shaded.com.google.protobuf; - -/** - * Base interface for methods common to {@link MessageLite} - * and {@link MessageLite.Builder} to provide type equivalency. - * - * @author jonp@google.com (Jon Perlow) - */ -public interface MessageLiteOrBuilder { - /** - * Get an instance of the type with no fields set. Because no fields are set, - * all getters for singular fields will return default values and repeated - * fields will appear empty. - * This may or may not be a singleton. This differs from the - * {@code getDefaultInstance()} method of generated message classes in that - * this method is an abstract method of the {@code MessageLite} interface - * whereas {@code getDefaultInstance()} is a static method of a specific - * class. They return the same thing. - */ - MessageLite getDefaultInstanceForType(); - - /** - * Returns true if all required fields in the message and all embedded - * messages are set, false otherwise. - * - *

See also: {@link MessageOrBuilder#getInitializationErrorString()} - */ - boolean isInitialized(); - -}