Interface SyntaxInfo.Builder<B extends SyntaxInfo.Builder<B,E>,E extends SyntaxElement>
- Type Parameters:
B
- The type of builder being used.E
- The class providing the implementation of the syntax info being built.
- All Superinterfaces:
Builder<SyntaxInfo.Builder<?,
?>, SyntaxInfo<?>>
- All Known Subinterfaces:
BukkitSyntaxInfos.Event.Builder<B,
,E> DefaultSyntaxInfos.Expression.Builder<B,
,E, R> DefaultSyntaxInfos.Structure.Builder<B,
E>
- Enclosing interface:
SyntaxInfo<E extends SyntaxElement>
public static interface SyntaxInfo.Builder<B extends SyntaxInfo.Builder<B,E>,E extends SyntaxElement>
extends Builder<SyntaxInfo.Builder<?,?>,SyntaxInfo<?>>
A builder is used for constructing a new syntax info.
- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddPattern
(String pattern) Adds a new pattern to the syntax info.addPatterns
(String... patterns) Adds new patterns to the syntax info.addPatterns
(Collection<String> patterns) Adds new patterns to the syntax info.void
applyTo
(SyntaxInfo.Builder<?, ?> builder) Applies the values of this builder ontobuilder
.build()
Builds a new syntax info from the set details.Removes all patterns from the syntax info.origin
(SyntaxOrigin origin) Sets the origin the syntax info will use.Sets the priority the syntax info will use, which dictates its position for matching during parsing.Sets the supplier the syntax info will use to create new instances of the implementing class.
-
Method Details
-
origin
Sets the origin the syntax info will use.- Parameters:
origin
- The origin to use.- Returns:
- This builder.
- See Also:
-
supplier
Sets the supplier the syntax info will use to create new instances of the implementing class.- Parameters:
supplier
- The supplier to use.- Returns:
- This builder.
- See Also:
-
addPattern
Adds a new pattern to the syntax info.- Parameters:
pattern
- The pattern to add.- Returns:
- This builder.
- See Also:
-
addPatterns
Adds new patterns to the syntax info.- Parameters:
patterns
- The patterns to add.- Returns:
- This builder.
- See Also:
-
addPatterns
Adds new patterns to the syntax info.- Parameters:
patterns
- The patterns to add.- Returns:
- This builder.
- See Also:
-
clearPatterns
Removes all patterns from the syntax info.- Returns:
- This builder.
- See Also:
-
priority
Sets the priority the syntax info will use, which dictates its position for matching during parsing.- Parameters:
priority
- The priority to use.- Returns:
- This builder.
-
build
Builds a new syntax info from the set details.- Specified by:
build
in interfaceBuilder<B extends SyntaxInfo.Builder<B,
E>, E extends SyntaxElement> - Returns:
- A syntax info representing the class providing the syntax's implementation.
-
applyTo
Applies the values of this builder ontobuilder
. When using this method, it is possible that some values are not safe to copy over. For example, when applying a SyntaxInfo for some type to a SyntaxInfo of another type, it is *not* safe to copy oversupplier(Supplier)
, but that operation will occur anyway. In cases like this, you are expected to correct the values.- Specified by:
applyTo
in interfaceBuilder<B extends SyntaxInfo.Builder<B,
E>, E extends SyntaxElement> - Parameters:
builder
- The builder to apply values onto.
-