Class ProgramRegistry

  • All Implemented Interfaces:
    net.morimekta.providence.util.TypeRegistry

    public class ProgramRegistry
    extends java.lang.Object
    implements net.morimekta.providence.util.TypeRegistry
    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 Summary

      Constructors 
      Constructor Description
      ProgramRegistry()
      Create an empty program registry.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsProgramPath​(java.lang.String path)
      Gets the document for a given file path.
      <T> T getConstantValue​(java.lang.String constReference, java.lang.String programContext)  
      <T extends net.morimekta.providence.descriptor.PDeclaredDescriptor<T>>
      T
      getDeclaredType​(java.lang.String typeName, java.lang.String programContext)  
      java.util.Collection<ProgramTypeRegistry> getLoadedRegistries()  
      net.morimekta.providence.descriptor.PDescriptorProvider getProvider​(java.lang.String typeName, java.lang.String programContext, java.util.Map<java.lang.String,java.lang.String> annotations)  
      net.morimekta.providence.descriptor.PService getService​(java.lang.String serviceName, java.lang.String programContext)  
      net.morimekta.providence.descriptor.PServiceProvider getServiceProvider​(java.lang.String serviceName, java.lang.String programContext)  
      void putProgram​(java.lang.String path, CProgram program)
      Put the given program into the registry at the given path.
      void putProgramType​(java.lang.String path, net.morimekta.providence.model.ProgramType program)
      Put the given program into the registry at the given path.
      ProgramTypeRegistry registryForPath​(java.lang.String path)
      Get a program type registry for the file at given path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface net.morimekta.providence.util.TypeRegistry

        getDeclaredType, getEnumType, getMessageType, getService
    • Constructor Detail

      • ProgramRegistry

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

      • registryForPath

        @Nonnull
        public ProgramTypeRegistry registryForPath​(java.lang.String path)
        Get a program type registry for the file at given path. If the registry is not created yet, it will be created.
        Parameters:
        path - The thrift file path.
        Returns:
        The associated program type registry.
      • getLoadedRegistries

        @Nonnull
        public java.util.Collection<ProgramTypeRegistry> getLoadedRegistries()
        Returns:
        A list of all created registries. Does not care if the registry has been initialized / filled yet.
      • containsProgramPath

        public boolean containsProgramPath​(java.lang.String path)
        Gets the document for a given file path.
        Parameters:
        path - The file path.
        Returns:
        The contained document, or null if not found.
      • putProgram

        public void putProgram​(java.lang.String path,
                               CProgram program)
        Put the given program into the registry at the given path.
        Parameters:
        path - The thrift file path.
        program - The contained program.
      • putProgramType

        public void putProgramType​(java.lang.String path,
                                   net.morimekta.providence.model.ProgramType program)
        Put the given program into the registry at the given path.
        Parameters:
        path - The thrift file path.
        program - The contained program.
      • getDeclaredType

        @Nonnull
        public <T extends net.morimekta.providence.descriptor.PDeclaredDescriptor<T>> T getDeclaredType​(@Nonnull
                                                                                                        java.lang.String typeName,
                                                                                                        @Nonnull
                                                                                                        java.lang.String programContext)
        Specified by:
        getDeclaredType in interface net.morimekta.providence.util.TypeRegistry
      • getConstantValue

        @Nullable
        public <T> T getConstantValue​(@Nonnull
                                      java.lang.String constReference,
                                      @Nonnull
                                      java.lang.String programContext)
        Specified by:
        getConstantValue in interface net.morimekta.providence.util.TypeRegistry
      • getService

        @Nonnull
        public net.morimekta.providence.descriptor.PService getService​(java.lang.String serviceName,
                                                                       java.lang.String programContext)
        Specified by:
        getService in interface net.morimekta.providence.util.TypeRegistry
      • getProvider

        @Nonnull
        public net.morimekta.providence.descriptor.PDescriptorProvider getProvider​(java.lang.String typeName,
                                                                                   java.lang.String programContext,
                                                                                   java.util.Map<java.lang.String,java.lang.String> annotations)
        Specified by:
        getProvider in interface net.morimekta.providence.util.TypeRegistry
      • getServiceProvider

        @Nonnull
        public net.morimekta.providence.descriptor.PServiceProvider getServiceProvider​(java.lang.String serviceName,
                                                                                       java.lang.String programContext)
        Specified by:
        getServiceProvider in interface net.morimekta.providence.util.TypeRegistry