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 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>
A builder is used for constructing a new syntax info.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    addPattern(String pattern)
    Adds a new pattern to the syntax info.
    addPatterns(String... patterns)
    Adds new patterns to the syntax info.
    Adds new patterns to the syntax info.
    void
    Applies the values of this builder onto builder.
    Builds a new syntax info from the set details.
    Removes all patterns from the syntax info.
    Sets the origin the syntax info will use.
    priority(Priority priority)
    Sets the priority the syntax info will use, which dictates its position for matching during parsing.
    supplier(Supplier<E> supplier)
    Sets the supplier the syntax info will use to create new instances of the implementing class.
  • Method Details

    • origin

      @Contract("_ -> this") B origin(SyntaxOrigin origin)
      Sets the origin the syntax info will use.
      Parameters:
      origin - The origin to use.
      Returns:
      This builder.
      See Also:
    • supplier

      @Contract("_ -> this") B supplier(Supplier<E> 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

      @Contract("_ -> this") B addPattern(String pattern)
      Adds a new pattern to the syntax info.
      Parameters:
      pattern - The pattern to add.
      Returns:
      This builder.
      See Also:
    • addPatterns

      @Contract("_ -> this") B addPatterns(String... patterns)
      Adds new patterns to the syntax info.
      Parameters:
      patterns - The patterns to add.
      Returns:
      This builder.
      See Also:
    • addPatterns

      @Contract("_ -> this") B addPatterns(Collection<String> patterns)
      Adds new patterns to the syntax info.
      Parameters:
      patterns - The patterns to add.
      Returns:
      This builder.
      See Also:
    • clearPatterns

      @Contract("-> this") B clearPatterns()
      Removes all patterns from the syntax info.
      Returns:
      This builder.
      See Also:
    • priority

      @Contract("_ -> this") B priority(Priority 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

      @Contract("-> new") SyntaxInfo<E> build()
      Builds a new syntax info from the set details.
      Returns:
      A syntax info representing the class providing the syntax's implementation.
    • applyTo

      void applyTo(SyntaxInfo.Builder<?,?> builder)
      Applies the values of this builder onto builder. 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 over supplier(Supplier), but that operation will occur anyway. In cases like this, you are expected to correct the values.
      Parameters:
      builder - The builder to apply values onto.