T
- the type to create Option
s fromR
- the owner of the optionspublic class OptionsBuilder<T,R extends OptionOwner> extends Object
Option
s, providing a fluent API.Modifier | Constructor and Description |
---|---|
protected |
OptionsBuilder() |
|
OptionsBuilder(R owner)
Create a new builder, using the given owner.
|
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
|
public OptionsBuilder(R owner)
owner
- the owner of the optionsprotected OptionsBuilder()
protected void setOwner(R owner)
owner
- the ownerpublic OptionsBuilder<T,R> options(Iterable<T> elements)
elements
- the elementspublic OptionsBuilder<T,R> name(NameProvider<T> nameProvider)
NameProvider
to use when setting an option's namenameProvider
- the providerpublic OptionsBuilder<T,R> selector(OptionOwner.Selector selector)
OptionOwner.Selector
to use when selecting options.selector
- the selectorselect(Object)
,
select(Collection)
public OptionsBuilder<T,R> select(Collection<T> selected)
selected
- the selected elementsselector
,
select(Object)
public OptionsBuilder<T,R> select(T selected)
selected
- the selected elementselector
,
select(Collection)
public OptionsBuilder<T,R> disable(Collection<T> disabled)
disabled
- the disabled elementdisable(Object)
public OptionsBuilder<T,R> disable(T disabled)
disabled
- the disabled elementsdisable(Collection)
public OptionsBuilder<T,R> defaultOption(String name, String value)
name
- the name for the option to be addedvalue
- the value for the option to be addedpublic OptionsBuilder<T,R> hitCounter(OptionOwner.HitCounter<T> counter)
OptionOwner.HitCounter
counter
- the counterpublic R build()
Copyright © 2011–2021 aiticon GmbH. All rights reserved.