public class Options extends AbstractSet<OptionEntry> implements Cloneable, Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
Options.InsertPos
InsertPos enum
|
static interface |
Options.OptionGroupResolver |
| Modifier and Type | Field and Description |
|---|---|
protected ArrayList<OptionEntry> |
list |
protected Options.OptionGroupResolver |
optionGroupResolver |
| Constructor and Description |
|---|
Options() |
Options(Class<?> enumType) |
Options(int initialCapacity) |
Options(OptionEntry[] entries) |
Options(Options other) |
| Modifier and Type | Method and Description |
|---|---|
Options |
add(Object value,
String text)
Adds or updates an option
Same as set() but allows Option building
|
Options |
add(Object value,
String text,
boolean active)
Adds or updates an option
Same as set() but allows Option building
|
boolean |
add(OptionEntry option) |
boolean |
addAll(Collection<? extends OptionEntry> source) |
void |
addXml(Element element,
DataType dataType)
Adds all these options to the xml element
|
void |
append(Object value,
String text,
boolean active)
Appends an option
Useful for fast loading when it is certain that there are no duplicates
WARNING: Does not check if the entry already exists
|
void |
append(OptionEntry option)
Appends an option
Useful for fast loading when it is certain that there are no duplicates
WARNING: Does not check if the entry already exists
|
void |
clear() |
Options |
clone() |
boolean |
contains(Object value) |
boolean |
containsNull()
Checks if the Option list contains an empty value
|
protected OptionEntry |
createOptionEntry(Object value,
String text,
boolean active) |
protected int |
findInsertPos(String text) |
String |
get(Object value) |
Options |
getActive()
Returns the subset of active options
|
int |
getActiveCount()
Returns the number of active elements
|
OptionEntry |
getEntry(Object value) |
protected int |
getIndex(Object value) |
Options.OptionGroupResolver |
getOptionGroupResolver()
Returns the function that determines the group to which an option entry belongs.
|
String |
getTextAt(int i)
Gets the text of the entry at index i
|
Object |
getValueAt(int i)
Gets the value of the entry at index i
|
Set<Object> |
getValues()
Returns all values as a set
|
Set<Object> |
getValues(boolean activeOnly)
Returns all values as a set
|
boolean |
has(Object value)
same as contains(), but IDE may not issue warning
|
boolean |
isActive(Object value) |
boolean |
isEmpty() |
Iterator<OptionEntry> |
iterator() |
Map<Object,String> |
map()
Returns an immutable Map for the options
|
<T> Map<T,String> |
map(Class<T> type)
Returns an immutable Map for the options
|
boolean |
remove(Object value) |
void |
set(Object value,
String text)
Sets or adds Adds an option at the bottom
|
void |
set(Object value,
String text,
Boolean active)
Sets or adds Adds an option at the bottom
|
void |
set(Object value,
String text,
Boolean active,
Options.InsertPos pos)
Sets or Adds an option at a certain position
|
void |
set(Object value,
String text,
Options.InsertPos pos)
Sets or Adds an option at a certain position
|
void |
setOptionGroupResolver(Options.OptionGroupResolver optionGroupResolver)
Sets a function that determines the group to which an option entry belongs.
|
int |
size() |
Object[] |
toArray() |
String |
toString() |
equals, hashCode, removeAllcontainsAll, retainAll, toArrayfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, retainAll, spliterator, toArrayparallelStream, removeIf, streamprotected final ArrayList<OptionEntry> list
protected Options.OptionGroupResolver optionGroupResolver
public Options()
public Options(int initialCapacity)
public Options(Options other)
public Options(OptionEntry[] entries)
public Options(Class<?> enumType)
public boolean addAll(Collection<? extends OptionEntry> source)
addAll in interface Collection<OptionEntry>addAll in interface Set<OptionEntry>addAll in class AbstractCollection<OptionEntry>public Options.OptionGroupResolver getOptionGroupResolver()
public void setOptionGroupResolver(Options.OptionGroupResolver optionGroupResolver)
optionGroupResolver - the group resolver functionprotected int getIndex(Object value)
protected OptionEntry createOptionEntry(Object value, String text, boolean active)
public OptionEntry getEntry(Object value)
public boolean isActive(Object value)
public Object getValueAt(int i)
i - the indexnull if not foundpublic String getTextAt(int i)
i - the indexpublic Set<Object> getValues(boolean activeOnly)
activeOnly - flag whether to return the active items onlypublic int getActiveCount()
public Options getActive()
public void set(Object value, String text, Boolean active, Options.InsertPos pos)
value - the value objecttext - the textactive - flag if element is active (selectable)pos - the position, see Options.InsertPospublic final void set(Object value, String text, Options.InsertPos pos)
value - the value objecttext - the textpos - the position, see Options.InsertPospublic void set(Object value, String text, Boolean active)
value - the value objecttext - the textactive - flag whether or not the option is activepublic final void set(Object value, String text)
value - the value objecttext - the textpublic final Options add(Object value, String text, boolean active)
value - the valuetext - the text for this valueactive - flag if element is active (selectable)public final Options add(Object value, String text)
value - the valuetext - the text for this valuepublic boolean add(OptionEntry option)
add in interface Collection<OptionEntry>add in interface Set<OptionEntry>add in class AbstractCollection<OptionEntry>public void append(OptionEntry option)
option - the option to appendpublic void append(Object value, String text, boolean active)
value - the value objecttext - the textactive - the flag whether or not this item is activepublic void clear()
clear in interface Collection<OptionEntry>clear in interface Set<OptionEntry>clear in class AbstractCollection<OptionEntry>public boolean contains(Object value)
contains in interface Collection<OptionEntry>contains in interface Set<OptionEntry>contains in class AbstractCollection<OptionEntry>public boolean containsNull()
public boolean has(Object value)
value - the value to checkpublic boolean isEmpty()
isEmpty in interface Collection<OptionEntry>isEmpty in interface Set<OptionEntry>isEmpty in class AbstractCollection<OptionEntry>public Iterator<OptionEntry> iterator()
iterator in interface Iterable<OptionEntry>iterator in interface Collection<OptionEntry>iterator in interface Set<OptionEntry>iterator in class AbstractCollection<OptionEntry>public boolean remove(Object value)
remove in interface Collection<OptionEntry>remove in interface Set<OptionEntry>remove in class AbstractCollection<OptionEntry>public int size()
size in interface Collection<OptionEntry>size in interface Set<OptionEntry>size in class AbstractCollection<OptionEntry>public Object[] toArray()
toArray in interface Collection<OptionEntry>toArray in interface Set<OptionEntry>toArray in class AbstractCollection<OptionEntry>public Map<Object,String> map()
public <T> Map<T,String> map(Class<T> type)
T - the type of the maptype - the map typepublic String toString()
toString in class AbstractCollection<OptionEntry>public void addXml(Element element, DataType dataType)
element - the element to add the option tags todataType - the dataType of the elementprotected int findInsertPos(String text)
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.