Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (C) 2016 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 com.google.api.tools.framework.model;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import com.google.common.collect.Ordering;
import com.google.common.collect.Queues;
import com.google.protobuf.DescriptorProtos;
import com.google.protobuf.DescriptorProtos.DescriptorProto;
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto;
import com.google.protobuf.DescriptorProtos.FileDescriptorProto;
import com.google.protobuf.DescriptorProtos.FileDescriptorSet;
import java.util.Deque;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
* Facilitates easy look up of extensions by name.
*/
public class ExtensionPool {
public static final ExtensionPool EMPTY =
new ExtensionPool(null, ImmutableMap.>of());
private static final Ordering> FIELD_NUMBER_ORDERING =
new Ordering>() {
@Override
public int compare(
Entry left, Entry right) {
return left.getValue().getProto().getNumber() - right.getValue().getProto().getNumber();
}
};
private final ImmutableMap> extensions;
private final FileDescriptorSet descriptor;
public static final ExtensionPool create(FileDescriptorSet extensionDescriptor) {
return new Builder().setFileDescriptorSet(extensionDescriptor).build();
}
private ExtensionPool(
FileDescriptorSet descriptor,
ImmutableMap> extensions) {
this.descriptor = descriptor;
this.extensions = extensions;
}
/**
* Returns an {@link Iterable} of extension names to {@link Extension}. Extension names
* are a fully qualified name surrounded by parentheses. The path of the name is determined by
* where the extension is defined. For example, given the extension defined below, the field name
* is "(foo.bar.baz)". The returned {@link Iterable} is sorted by field number.
*
*