Class SimpleTypeRegistry


  • public class SimpleTypeRegistry
    extends WritableTypeRegistry
    Registry for declared types referenced in a flat space program context. The registry itself does not have a context per se, as these may reference each other recursively. Note that this registry does not handle situations where two programs with the same name exist with a type each with the same name.
    • Constructor Detail

      • SimpleTypeRegistry

        public SimpleTypeRegistry()
    • Method Detail

      • isKnownProgram

        public boolean isKnownProgram​(@Nonnull
                                      java.lang.String programName)
        Specified by:
        isKnownProgram in class TypeRegistry
        Parameters:
        programName - The program name.
        Returns:
        True if the program is known in this registry.
      • 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.
      • 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.
      • registerTypedef

        public void registerTypedef​(@Nonnull
                                    TypeReference reference,
                                    @Nonnull
                                    TypeReference target)
        Description copied from class: WritableTypeRegistry
        Registers a typedef definition. This is a pair of two type references. One for the reference itself, and one for the target type definition, including the local program context where it was defined.
        Specified by:
        registerTypedef in class WritableTypeRegistry
        Parameters:
        reference - The typedef reference source..
        target - The qualified type definition that the name represents with it's own context.
      • registerService

        public void registerService​(@Nonnull
                                    PService service)
        Description copied from class: WritableTypeRegistry
        Services are not handled as "declared types", so they need to be registered separately.
        Specified by:
        registerService in class WritableTypeRegistry
        Parameters:
        service - the service to register.