Class RecursiveTypeRegistry

  • All Implemented Interfaces:
    net.morimekta.providence.util.TypeRegistry, net.morimekta.providence.util.WritableTypeRegistry
    Direct Known Subclasses:
    ProgramTypeRegistry

    public class RecursiveTypeRegistry
    extends net.morimekta.providence.util.BaseTypeRegistry
    A registry that can reference each other recursively. Each registry will have a specific package context, and needs to be built up in a recursive manner. This way each type registry will only have access to the described types actually referenced and included in the given thrift program file.
    • Constructor Summary

      Constructors 
      Constructor Description
      RecursiveTypeRegistry​(java.lang.String localProgramContext)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <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.lang.String getLocalProgramContext()  
      RecursiveTypeRegistry getRegistryForProgramName​(java.lang.String programName)
      Get the registry to be used for the specific program.
      net.morimekta.providence.descriptor.PService getService​(java.lang.String serviceName, java.lang.String programContext)  
      protected boolean isEmpty()  
      <T> boolean register​(net.morimekta.providence.descriptor.PDeclaredDescriptor<T> declaredType)  
      boolean register​(net.morimekta.providence.descriptor.PService service)  
      void registerConstant​(java.lang.String identifier, java.lang.String program, java.lang.Object value)  
      void registerInclude​(java.lang.String programName, RecursiveTypeRegistry registry)
      Register a recursive included registry.
      • Methods inherited from class net.morimekta.providence.util.BaseTypeRegistry

        finalTypename, getProvider, getServiceProvider, qualifiedNameFromIdAndContext, registerRecursively, registerRecursively, registerTypedef
      • 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

      • RecursiveTypeRegistry

        public RecursiveTypeRegistry​(@Nonnull
                                     java.lang.String localProgramContext)
    • Method Detail

      • getLocalProgramContext

        public java.lang.String getLocalProgramContext()
      • getRegistryForProgramName

        public RecursiveTypeRegistry getRegistryForProgramName​(java.lang.String programName)
        Get the registry to be used for the specific program. Search through all the included registries to find the best one.
        Parameters:
        programName - The program to find registry for.
        Returns:
        The Recursive type registry or null of not found.
      • registerInclude

        public void registerInclude​(java.lang.String programName,
                                    RecursiveTypeRegistry registry)
        Register a recursive included registry.
        Parameters:
        programName - The program to be included.
        registry - The registry for the given program.
      • getDeclaredType

        @Nonnull
        public <T extends net.morimekta.providence.descriptor.PDeclaredDescriptor<T>> T getDeclaredType​(@Nonnull
                                                                                                        java.lang.String typeName,
                                                                                                        @Nonnull
                                                                                                        java.lang.String programContext)
      • getConstantValue

        @Nullable
        public <T> T getConstantValue​(@Nonnull
                                      java.lang.String constReference,
                                      @Nonnull
                                      java.lang.String programContext)
      • getService

        @Nonnull
        public net.morimekta.providence.descriptor.PService getService​(java.lang.String serviceName,
                                                                       java.lang.String programContext)
      • registerConstant

        public void registerConstant​(@Nonnull
                                     java.lang.String identifier,
                                     @Nonnull
                                     java.lang.String program,
                                     @Nonnull
                                     java.lang.Object value)
      • register

        public boolean register​(@Nonnull
                                net.morimekta.providence.descriptor.PService service)
      • register

        public <T> boolean register​(net.morimekta.providence.descriptor.PDeclaredDescriptor<T> declaredType)
      • isEmpty

        protected boolean isEmpty()