com.foursquare.spindle.codegen.runtime

TypeDeclarationResolver

class TypeDeclarationResolver extends AnyRef

TypeDeclarations are used to bridge the gap between the type information contained in the TypeRegistry (which can only resolve types included in the same file) and the type information needed to compile a file (which might span several source files, because of includes).

TypeDeclarationResolver will look across several source files and resolve all the types declared in any of those files.

The following Thrift keywords can declare new types: enum, struct, union, exception, service, typedef.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. TypeDeclarationResolver
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TypeDeclarationResolver(enhancedTypes: (TypeReference, Annotations, Scope) ⇒ Option[TypeReference])

Type Members

  1. case class ScopedTypedef(typedef: Typedef, program: ProgramSource, scope: Map[String, TypeDeclaration]) extends Product with Serializable

    Helper class to hold a type declaration and all the parts necessary for it to be properly scoped.

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def debugScopedTypedef(unresolvedTypedef: ScopedTypedef): String

  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. def findUnresolvedTypedefs(programs: Seq[ProgramSource], decls: Map[ProgramSource, Map[String, TypeDeclaration]]): Seq[ScopedTypedef]

    Given a set of programs and the currently resolved type declarations, finds any typedefs that are yet to be resolved and properly scopes them.

    Given a set of programs and the currently resolved type declarations, finds any typedefs that are yet to be resolved and properly scopes them.

    programs

    - set of programs for which to resolve typedef declarations

    decls

    - a map of already-resolved type declarations, keyed first by program name and then by type alias

  13. def firstPassResolveTypeDeclarations(program: ProgramSource): Map[ProgramSource, Map[String, TypeDeclaration]]

    Takes a program and resolves the "first pass" TypeDeclarations.

    Takes a program and resolves the "first pass" TypeDeclarations. That is, the easy ones.

    Resolves types declared as enums, structs, unions, and exceptions. Typedefs are left for the recursive phase, because they can reference types across source boundaries.

    Types declared as services are not resolved, because they cannot be referenced in Thrift files.

    program

    - program for which to resolve type declarations

  14. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  17. def makeAnnotations(annotations: Seq[Annotation]): Annotations

  18. def mergeMaps[A, B, C](x: Map[A, Map[B, C]], y: Map[A, Map[B, C]]): Map[A, Map[B, C]]

    Helper method to merge two nested maps.

  19. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  22. final def recursiveResolveTypeDeclarations(programs: Seq[ProgramSource], decls: Map[ProgramSource, Map[String, TypeDeclaration]]): Map[ProgramSource, Map[String, TypeDeclaration]]

    Takes a set of programs and recursively resolves all the types declared as typedefs.

    Takes a set of programs and recursively resolves all the types declared as typedefs.

    These declarations can reference types across source boundaries, so we must keep track of all included program sources and all the type declarations seen so far in order to successfully resolve.

    For each pass, the set of type declarations which have not yet been resolved is found. If the set is empty, the recursion is done. If the set is non-empty, an attempt is made to resolve those type declarations. If any progress is made, the recursion continues. If no progress is made, the recursion terminates with an exception.

    programs

    - set of programs for which to resolve typedef declarations

    decls

    - a map of already-resolved type declarations, keyed first by program name and then by type alias

    Annotations
    @tailrec()
  23. def resolveAdditional(scopedTypedefs: Seq[ScopedTypedef]): Map[String, TypeDeclaration]

    Given a set of scoped type declarations, attempts to resolve them.

    Given a set of scoped type declarations, attempts to resolve them. Returns a map of successfully resolved type declarations.

    May not resolve all the given type declarations.

    scopedTypedefs

    - set of scoped type declarations to resolve

  24. def resolveAllTypeDeclarations(programs: Seq[ProgramSource]): Map[ProgramSource, Map[String, TypeDeclaration]]

    Takes a set of programs and resolves all its type declarations.

    Takes a set of programs and resolves all its type declarations.

    This is accomplished in a series of passes. The first pass resolves all type declarations which cannot reference other types (enum, struct, union exception). Subsequent passes attempt to resolve type declarations that can reference other types (typedefs).

    programs

    - set of programs for which to resolve type declarations

  25. def seqToMapBy[T, K, V](xs: Seq[T])(f: (T) ⇒ (K, V)): Map[K, V]

  26. def seqToMapByKey[T, K](xs: Seq[T])(f: (T) ⇒ K): Map[K, T]

  27. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  28. def toString(): String

    Definition Classes
    AnyRef → Any
  29. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped