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.processors.normalizer;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.google.protobuf.Any;
import com.google.protobuf.BoolValue;
import com.google.protobuf.ByteString;
import com.google.protobuf.BytesValue;
import com.google.protobuf.DescriptorProtos.DescriptorProto;
import com.google.protobuf.DescriptorProtos.EnumDescriptorProto;
import com.google.protobuf.DescriptorProtos.EnumOptions;
import com.google.protobuf.DescriptorProtos.EnumValueDescriptorProto;
import com.google.protobuf.DescriptorProtos.EnumValueOptions;
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto;
import com.google.protobuf.DescriptorProtos.FieldOptions;
import com.google.protobuf.DescriptorProtos.MessageOptions;
import com.google.protobuf.DescriptorProtos.MethodDescriptorProto;
import com.google.protobuf.DescriptorProtos.MethodOptions;
import com.google.protobuf.DescriptorProtos.OneofDescriptorProto;
import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto;
import com.google.protobuf.DescriptorProtos.ServiceOptions;
import com.google.protobuf.Descriptors.EnumValueDescriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.DoubleValue;
import com.google.protobuf.FloatValue;
import com.google.protobuf.Int32Value;
import com.google.protobuf.Int64Value;
import com.google.protobuf.Message;
import com.google.protobuf.Option;
import com.google.protobuf.StringValue;
import com.google.protobuf.UInt32Value;
import com.google.protobuf.UInt64Value;
import java.util.List;
import java.util.Map;
/**
* Descriptor normalization utility methods.
*/
public final class DescriptorNormalization {
private DescriptorNormalization() {}
static final java.lang.String TYPE_SERVICE_BASE_URL = "type.googleapis.com";
private static final Predicate HAS_DEFAULT_VALUE =
new Predicate() {
@Override
public boolean apply(FieldDescriptor input) {
return input.hasDefaultValue();
}
};
private static final List DEFAULT_ENUM_OPTIONS =
FluentIterable.from(EnumOptions.getDescriptor().getFields())
.filter(HAS_DEFAULT_VALUE)
.toList();
private static final List DEFAULT_ENUM_VALUE_OPTIONS =
FluentIterable.from(EnumValueOptions.getDescriptor().getFields())
.filter(HAS_DEFAULT_VALUE)
.toList();
private static final List DEFAULT_FIELD_OPTIONS =
FluentIterable.from(FieldOptions.getDescriptor().getFields())
.filter(HAS_DEFAULT_VALUE)
.toList();
private static final List DEFAULT_MESSAGE_OPTIONS =
FluentIterable.from(MessageOptions.getDescriptor().getFields())
.filter(HAS_DEFAULT_VALUE)
.toList();
private static final List DEFAULT_METHOD_OPTIONS =
FluentIterable.from(MethodOptions.getDescriptor().getFields())
.filter(HAS_DEFAULT_VALUE)
.toList();
private static final List DEFAULT_SERVICE_OPTIONS =
FluentIterable.from(ServiceOptions.getDescriptor().getFields())
.filter(HAS_DEFAULT_VALUE)
.toList();
public static List