org.appng.api.support

## Class OptionsBuilder<T,R extends OptionOwner>

- java.lang.Object
- - org.appng.api.support.OptionsBuilder<T,R>

- Type Parameters:
    `T` - the type to create `Option`s from
    `R` - the owner of the options
  Direct Known Subclasses:
    SelectionBuilder

      public class OptionsBuilder<T,R extends OptionOwner>
      extends Object

  A builder for `Option`s, providing a fluent API.
  Author:
    Matthias Müller

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `OptionsBuilder()`
    `` | `OptionsBuilder(R owner)` Create a new builder, using the given owner.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `R` | `build()` Creates the options and adds the to the owner
    `OptionsBuilder<T,R>` | `defaultOption(String name, String value)` Adds an option at the very first position
    `OptionsBuilder<T,R>` | `disable(Collection<T> disabled)` Disables a single element, i.e.
    `OptionsBuilder<T,R>` | `disable(T disabled)` Disables some elements, i.e.
    `OptionsBuilder<T,R>` | `hitCounter(OptionOwner.HitCounter<T> counter)` Sets a `OptionOwner.HitCounter`
    `OptionsBuilder<T,R>` | `name(NameProvider<T> nameProvider)` Sets the `NameProvider` to use when setting an option's name
    `OptionsBuilder<T,R>` | `options(Iterable<T> elements)` Sets the elements to build options from
    `OptionsBuilder<T,R>` | `select(Collection<T> selected)` Selects some elements, i.e.
    `OptionsBuilder<T,R>` | `select(T selected)` Selects a single elements, i.e.
    `OptionsBuilder<T,R>` | `selector(OptionOwner.Selector selector)` Sets the `OptionOwner.Selector` to use when selecting options.
    `protected void` | `setOwner(R owner)` Sets the owner for this builder

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OptionsBuilder

          public OptionsBuilder(R owner)

      Create a new builder, using the given owner.
      Parameters:
        `owner` - the owner of the options

    - #### OptionsBuilder

          protected OptionsBuilder()

  - ### Method Detail

    - #### setOwner

          protected void setOwner(R owner)

      Sets the owner for this builder
      Parameters:
        `owner` - the owner

    - #### options

          public OptionsBuilder<T,R> options(Iterable<T> elements)

      Sets the elements to build options from
      Parameters:
        `elements` - the elements
      Returns:
        this builder

    - #### name

          public OptionsBuilder<T,R> name(NameProvider<T> nameProvider)

      Sets the `NameProvider` to use when setting an option's name
      Parameters:
        `nameProvider` - the provider
      Returns:
        this builder

    - #### selector

          public OptionsBuilder<T,R> selector(OptionOwner.Selector selector)

      Sets the `OptionOwner.Selector` to use when selecting options.
      Parameters:
        `selector` - the selector
      Returns:
        this builder
      See Also:
        `select(Object)`, `select(Collection)`

    - #### select

          public OptionsBuilder<T,R> select(Collection<T> selected)

      Selects some elements, i.e. the created options will be selected.
      Parameters:
        `selected` - the selected elements
      Returns:
        this builder
      See Also:
        `selector`, `select(Object)`

    - #### select

          public OptionsBuilder<T,R> select(T selected)

      Selects a single elements, i.e. the created option will be selected.
      Parameters:
        `selected` - the selected element
      Returns:
        this builder
      See Also:
        `selector`, `select(Collection)`

    - #### disable

          public OptionsBuilder<T,R> disable(Collection<T> disabled)

      Disables a single element, i.e. the created option will be disabled
      Parameters:
        `disabled` - the disabled element
      Returns:
        this builder
      See Also:
        `disable(Object)`

    - #### disable

          public OptionsBuilder<T,R> disable(T disabled)

      Disables some elements, i.e. the created options will be disabled
      Parameters:
        `disabled` - the disabled elements
      Returns:
        this builder
      See Also:
        `disable(Collection)`

    - #### defaultOption

          public OptionsBuilder<T,R> defaultOption(String name,
                                                   String value)

      Adds an option at the very first position
      Parameters:
        `name` - the name for the option to be added
        `value` - the value for the option to be added
      Returns:
        this builder

    - #### hitCounter

          public OptionsBuilder<T,R> hitCounter(OptionOwner.HitCounter<T> counter)

      Sets a `OptionOwner.HitCounter`
      Parameters:
        `counter` - the counter
      Returns:
        this builder

    - #### build

          public R build()

      Creates the options and adds the to the owner
      Returns:
        the owner the options

Copyright © 2011–2023 aiticon GmbH. All rights reserved.