Class GlobalRegistry


  • public class GlobalRegistry
    extends TypeRegistry
    A global type registry containing lots of individual program registries for each program. The program registry is a wrapper around a set of type registries for each of a set of different files. The individual registries are identified by the path to the thrift file that was parsed.
    • Constructor Detail

      • GlobalRegistry

        public GlobalRegistry()
        Create an empty program registry.
    • Method Detail

      • registryForPath

        @Nonnull
        public ProgramRegistry registryForPath​(java.lang.String filePath)
      • getDeclaredType

        @Nonnull
        public java.util.Optional<PDeclaredDescriptor<?>> getDeclaredType​(@Nonnull
                                                                          TypeReference reference)
        Description copied from class: TypeRegistry
        Get the declared type with the given name and program context.
        Specified by:
        getDeclaredType in class TypeRegistry
        Parameters:
        reference - The reference to the type.
        Returns:
        Optional type descriptor.
      • getService

        @Nonnull
        public java.util.Optional<PService> getService​(@Nonnull
                                                       TypeReference reference)
        Description copied from class: TypeRegistry
        Get a service definition from the name and program context.
        Specified by:
        getService in class TypeRegistry
        Parameters:
        reference - The service reference.
        Returns:
        Optional service descriptor.
      • getConstantValue

        @Nonnull
        public <T> java.util.Optional<T> getConstantValue​(@Nonnull
                                                          TypeReference reference)
        Description copied from class: TypeRegistry
        This is to check to find a constant given the const name and program context. This will return empty if the constant does not exist.
        Specified by:
        getConstantValue in class TypeRegistry
        Type Parameters:
        T - The returned value type.
        Parameters:
        reference - The constant reference.
        Returns:
        The optional const value.
      • getTypedef

        @Nonnull
        public java.util.Optional<TypeReference> getTypedef​(@Nonnull
                                                            TypeReference reference)
        Description copied from class: TypeRegistry
        Get a type-definition for the given reference.
        Specified by:
        getTypedef in class TypeRegistry
        Parameters:
        reference - The typedef reference.
        Returns:
        Optional typedef definition.
      • isKnownProgram

        public boolean isKnownProgram​(@Nonnull
                                      java.lang.String program)
        Specified by:
        isKnownProgram in class TypeRegistry
        Parameters:
        program - The program name.
        Returns:
        True if the program is known in this registry.