Interface SyntaxRegistry
- All Superinterfaces:
Iterable<SyntaxInfo<?>>
,Registry<SyntaxInfo<?>>
,ViewProvider<SyntaxRegistry>
@Experimental
public interface SyntaxRegistry
extends ViewProvider<SyntaxRegistry>, Registry<SyntaxInfo<?>>
A syntax registry manages all
SyntaxRegister
s for syntax registration.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
SyntaxRegistry.ChildKey<I extends P,
P extends SyntaxInfo<?>> Like aSyntaxRegistry.Key
, but it has a parent which causes elements to be registered to itself and its parent.static interface
SyntaxRegistry.Key<I extends SyntaxInfo<?>>
Represents a syntax element type. -
Field Summary
Modifier and TypeFieldDescriptionstatic final SyntaxRegistry.Key
<SyntaxInfo<? extends Condition>> A key representing the built-inCondition
syntax element.static final SyntaxRegistry.Key
<SyntaxInfo<? extends Effect>> A key representing the built-inEffect
syntax element.static final SyntaxRegistry.Key
<DefaultSyntaxInfos.Expression<?, ?>> A key representing the built-inExpression
syntax element.static final SyntaxRegistry.Key
<SyntaxInfo<? extends Section>> A key representing the built-inSection
syntax element.static final SyntaxRegistry.Key
<SyntaxInfo<? extends Statement>> A key representing allStatement
syntax elements.static final SyntaxRegistry.Key
<DefaultSyntaxInfos.Structure<?>> A key representing the built-inStructure
syntax element. -
Method Summary
Modifier and TypeMethodDescription@Unmodifiable Collection
<SyntaxInfo<?>> elements()
There are no guarantees on the ordering of the returned collection.static SyntaxRegistry
empty()
Constructs a default implementation of a syntax registry.<I extends SyntaxInfo<?>>
voidregister
(SyntaxRegistry.Key<I> key, I info) Registers a new syntax under a provided key.<I extends SyntaxInfo<?>>
@Unmodifiable Collection<I> syntaxes
(SyntaxRegistry.Key<I> key) A method to obtain all syntaxes registered under a certain key.default SyntaxRegistry
Constructs an unmodifiable view of this syntax registry.<I extends SyntaxInfo<?>>
voidunregister
(SyntaxRegistry.Key<I> key, I info) Unregisters a syntax registered under a provided key.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
STRUCTURE
A key representing the built-inStructure
syntax element. -
SECTION
A key representing the built-inSection
syntax element. -
STATEMENT
-
EFFECT
A key representing the built-inEffect
syntax element. -
CONDITION
A key representing the built-inCondition
syntax element. -
EXPRESSION
A key representing the built-inExpression
syntax element.
-
-
Method Details
-
empty
Constructs a default implementation of a syntax registry. This implementation is practically a wrapper aroundMap<Key<?>, SyntaxRegistry<?>>
.- Returns:
- A syntax registry containing no elements.
-
syntaxes
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
Registers a new syntax under a provided key.- Type Parameters:
I
- The syntax type.- Parameters:
key
- The key to registerinfo
under.info
- The syntax info to register.
-
unregister
Unregisters a syntax registered under a provided key.- Type Parameters:
I
- The syntax type.- Parameters:
key
- The key theinfo
is registered under.info
- The syntax info to unregister.
-
unmodifiableView
Constructs an unmodifiable view of this syntax registry. That is, the returned registry will not allow registrations.- Specified by:
unmodifiableView
in interfaceViewProvider<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 interfaceRegistry<SyntaxInfo<?>>
- Returns:
- An unmodifiable snapshot of all syntaxes registered.
-