All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.protostream.descriptors.FileDescriptor Maven / Gradle / Ivy

Go to download

ProtoStream is a serialization library based on Protocol buffers format for serializing structured data.

There is a newer version: 14.0.0.CR2
Show newest version
package org.infinispan.protostream.descriptors;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.infinispan.protostream.DescriptorParserException;
import org.infinispan.protostream.config.Configuration;
import org.infinispan.protostream.descriptors.namespace.FileNamespace;
import org.infinispan.protostream.descriptors.namespace.Namespace;
import org.infinispan.protostream.impl.Log;

/**
 * Representation of a .proto file, including its dependencies.
 *
 * @author gustavonalle
 * @author [email protected]
 * @since 2.0
 */
public final class FileDescriptor {

   public enum Syntax {
      PROTO2("proto2"),
      PROTO3("proto3");

      private final String syntax;

      Syntax(String syntax) {
         this.syntax = syntax;
      }

      public static Syntax fromString(String syntax) {
         if (syntax == null) {
            throw new IllegalArgumentException("argument cannot be null");
         }
         for (Syntax s : values()) {
            if (s.syntax.equals(syntax)) {
               return s;
            }
         }
         throw new IllegalArgumentException("Illegal syntax : '" + syntax + "'");
      }


      @Override
      public String toString() {
         return syntax;
      }
   }

   private static final Log log = Log.LogFactory.getLog(FileDescriptor.class);

   private final Syntax syntax;

   protected Configuration configuration;

   private final String name;
   private final String packageName;

   /**
    * The imports. These are not transitive.
    */
   private final List dependencies;

   /**
    * The public imports. These generate transitive dependencies.
    */
   private final List publicDependencies;

   private final List




© 2015 - 2024 Weber Informatics LLC | Privacy Policy