T
- Type of the option, crucial for the JavaScript generation. See
DatatableConfigGenerator
.public class Option<T> extends Object implements Comparable<Option<T>>
Representation of a component option, which is used to configure different aspects of a component.
Each Option
is composed of:
name
, which may be used in configuration propertiesOptionProcessor
which indicates how the value of
the option should be processedprecedence
to indicate if the Option
should be
processed before another oneOptions are registered in multiple ways:
Options are usually stored in Map
structures, such as
Map<Option<?>, Object>
where Object
is the value of the
option.
OptionProcessor
Constructor and Description |
---|
Option(String name,
OptionProcessor processor,
int precedence) |
Modifier and Type | Method and Description |
---|---|
void |
appendIn(ColumnConfiguration columnConfiguration,
char value) |
void |
appendIn(ColumnConfiguration columnConfiguration,
String value) |
void |
appendIn(TableConfiguration tableConfiguration,
char value) |
void |
appendIn(TableConfiguration tableConfiguration,
String value) |
int |
compareTo(Option<T> o)
Compare options according to their precedence.
|
boolean |
equals(Object obj) |
String |
getName() |
int |
getPrecedence() |
OptionProcessor |
getProcessor() |
String |
getUserName() |
int |
hashCode() |
void |
setIn(ColumnConfiguration columnConfiguration,
T value) |
void |
setIn(TableConfiguration tableConfiguration,
T value) |
void |
setIn(T value,
HtmlTable table) |
void |
setUserName(String userName)
TODO
|
String |
toString() |
T |
valueFrom(ColumnConfiguration columnConfiguration) |
T |
valueFrom(HtmlTable table) |
T |
valueFrom(Map<Option<?>,Object> configurations) |
T |
valueFrom(TableConfiguration tableConfiguration) |
public Option(String name, OptionProcessor processor, int precedence)
name
- processor
- precedence
- public String getName()
public String getUserName()
public void setUserName(String userName)
userName
- public OptionProcessor getProcessor()
OptionProcessor
to be applied on the value associated
with the option.public int getPrecedence()
public T valueFrom(TableConfiguration tableConfiguration)
public T valueFrom(ColumnConfiguration columnConfiguration)
public void setIn(ColumnConfiguration columnConfiguration, T value)
public void setIn(TableConfiguration tableConfiguration, T value)
public void appendIn(TableConfiguration tableConfiguration, String value)
public void appendIn(TableConfiguration tableConfiguration, char value)
public void appendIn(ColumnConfiguration columnConfiguration, String value)
public void appendIn(ColumnConfiguration columnConfiguration, char value)
public int compareTo(Option<T> o)
Compare options according to their precedence.
Be careful: This implementation of compareTo breaks (o1.compareTo(o2) == 0) == (o1.equals(o2)), as two different options can have the same precedence.
compareTo
in interface Comparable<Option<T>>
o
- the object to compare toCopyright © 2013–2015 Dandelion Project. All rights reserved.