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:
  • 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.
      Specified by:
      build in interface Builder<B extends SyntaxInfo.Builder<B,E>,E extends SyntaxElement>
      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.
      Specified by:
      applyTo in interface Builder<B extends SyntaxInfo.Builder<B,E>,E extends SyntaxElement>
      Parameters:
      builder - The builder to apply values onto.