Interface SyntaxRegistry

All Superinterfaces:
Iterable<SyntaxInfo<?>>, Registry<SyntaxInfo<?>>, ViewProvider<SyntaxRegistry>

@Experimental public interface SyntaxRegistry extends ViewProvider<SyntaxRegistry>, Registry<SyntaxInfo<?>>
A syntax registry manages all SyntaxRegisters for syntax registration.
  • Field Details

  • Method Details

    • empty

      @Contract("-> new") static SyntaxRegistry empty()
      Constructs a default implementation of a syntax registry. This implementation is practically a wrapper around Map<Key<?>, SyntaxRegistry<?>>.
      Returns:
      A syntax registry containing no elements.
    • syntaxes

      <I extends SyntaxInfo<?>> @Unmodifiable Collection<I> syntaxes(SyntaxRegistry.Key<I> key)
      A method to obtain all syntaxes registered under a certain key.
      Type Parameters:
      I - The syntax type.
      Parameters:
      key - The key to obtain syntaxes from.
      Returns:
      An unmodifiable snapshot of all syntaxes registered under key.
    • register

      <I extends SyntaxInfo<?>> void register(SyntaxRegistry.Key<I> key, I info)
      Registers a new syntax under a provided key.
      Type Parameters:
      I - The syntax type.
      Parameters:
      key - The key to register info under.
      info - The syntax info to register.
    • unregister

      <I extends SyntaxInfo<?>> void unregister(SyntaxRegistry.Key<I> key, I info)
      Unregisters a syntax registered under a provided key.
      Type Parameters:
      I - The syntax type.
      Parameters:
      key - The key the info is registered under.
      info - The syntax info to unregister.
    • unmodifiableView

      @Contract("-> new") default SyntaxRegistry unmodifiableView()
      Constructs an unmodifiable view of this syntax registry. That is, the returned registry will not allow registrations.
      Specified by:
      unmodifiableView in interface ViewProvider<SyntaxRegistry>
      Returns:
      An unmodifiable view of this syntax registry.
    • elements

      @Unmodifiable Collection<SyntaxInfo<?>> elements()
      There are no guarantees on the ordering of the returned collection.
      Specified by:
      elements in interface Registry<SyntaxInfo<?>>
      Returns:
      An unmodifiable snapshot of all syntaxes registered.