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) 2012 Facebook, 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.facebook.drift.idl.generator;
import com.facebook.drift.annotations.ThriftService;
import com.facebook.drift.codec.ThriftCodecManager;
import com.facebook.drift.codec.ThriftProtocolType;
import com.facebook.drift.codec.metadata.FieldKind;
import com.facebook.drift.codec.metadata.MetadataErrorException;
import com.facebook.drift.codec.metadata.MetadataErrors.Monitor;
import com.facebook.drift.codec.metadata.MetadataWarningException;
import com.facebook.drift.codec.metadata.ThriftCatalog;
import com.facebook.drift.codec.metadata.ThriftFieldMetadata;
import com.facebook.drift.codec.metadata.ThriftMethodMetadata;
import com.facebook.drift.codec.metadata.ThriftServiceMetadata;
import com.facebook.drift.codec.metadata.ThriftStructMetadata;
import com.facebook.drift.codec.metadata.ThriftType;
import com.facebook.drift.codec.metadata.ThriftTypeReference;
import com.google.common.base.VerifyException;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
import java.util.function.Predicate;
import static com.facebook.drift.codec.metadata.ReflectionHelper.getEffectiveClassAnnotations;
import static com.facebook.drift.idl.generator.ThriftIdlRenderer.renderThriftIdl;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.io.Files.getNameWithoutExtension;
import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
public class ThriftIdlGenerator
{
private static final Set BUILT_IN_TYPES = ImmutableSet.builder()
.add(ThriftType.BOOL)
.add(ThriftType.BYTE)
.add(ThriftType.I16)
.add(ThriftType.I32)
.add(ThriftType.I64)
.add(ThriftType.DOUBLE)
.add(ThriftType.STRING)
.add(ThriftType.BINARY)
.add(new ThriftType(ThriftType.BOOL, Boolean.class))
.add(new ThriftType(ThriftType.BYTE, Byte.class))
.add(new ThriftType(ThriftType.I16, Short.class))
.add(new ThriftType(ThriftType.I32, Integer.class))
.add(new ThriftType(ThriftType.I64, Long.class))
.add(new ThriftType(ThriftType.DOUBLE, Double.class))
.add(new ThriftType(ThriftType.STRING, String.class))
.add(new ThriftType(ThriftType.BINARY, byte[].class))
.build();
private final ClassLoader classLoader;
private final Consumer verboseLogger;
private final ThriftCodecManager codecManager;
private final String defaultPackage;
private final Map