|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<OptionEntry>
org.apache.empire.commons.Options
public class Options
This class represents a list of possible values that are valid for a particular field.
Additionally the class provides a text string describing the value for display purposes.
The class is implemented as a set of OptionEntry objects
where the entry value is used as the key for the set and thus must be unique.
Nested Class Summary | |
---|---|
static class |
Options.InsertPos
|
Constructor Summary | |
---|---|
Options()
|
|
Options(OptionEntry[] entries)
|
|
Options(Options other)
|
Method Summary | |
---|---|
void |
add(Object value,
String text,
boolean noCheck)
Adds an object, the check for an existing can be skipped for performance issues (not recommended!) |
boolean |
add(OptionEntry option)
|
void |
addXml(Element element,
long flags)
Adds all these options to the xml element |
void |
clear()
|
Options |
clone()
|
boolean |
contains(Object object)
|
protected OptionEntry |
createOptionEntry(Object value,
String text)
|
String |
get(Object value)
|
OptionEntry |
getEntry(Object value)
|
protected int |
getIndex(Object value)
|
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()
|
boolean |
isEmpty()
|
Iterator<OptionEntry> |
iterator()
|
boolean |
remove(Object object)
|
void |
set(Object value,
String text)
Sets or adds Adds an option at the bottom |
void |
set(Object value,
String text,
Options.InsertPos pos)
Sets or Adds an option at a certain position |
int |
size()
|
Object[] |
toArray()
|
String |
toString()
|
Methods inherited from class java.util.AbstractSet |
---|
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, containsAll, retainAll, toArray |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
addAll, containsAll, retainAll, toArray |
Constructor Detail |
---|
public Options()
public Options(Options other)
public Options(OptionEntry[] entries)
Method Detail |
---|
public Options clone()
clone
in class Object
protected int getIndex(Object value)
protected OptionEntry createOptionEntry(Object value, String text)
public OptionEntry getEntry(Object value)
public String get(Object value)
public Object getValueAt(int i)
i
- the index
null
if not foundpublic String getTextAt(int i)
i
- the index
public Set<Object> getValues()
public void set(Object value, String text, Options.InsertPos pos)
value
- the value objecttext
- the textpos
- the position, see Options.InsertPos
public void set(Object value, String text)
value
- the value objecttext
- the textpublic void add(Object value, String text, boolean noCheck)
value
- the valuetext
- the textnoCheck
- set to true to skip testing for an existing key (handle with care!)public boolean add(OptionEntry option)
add
in interface Collection<OptionEntry>
add
in interface Set<OptionEntry>
add
in class AbstractCollection<OptionEntry>
public void clear()
clear
in interface Collection<OptionEntry>
clear
in interface Set<OptionEntry>
clear
in class AbstractCollection<OptionEntry>
public boolean contains(Object object)
contains
in interface Collection<OptionEntry>
contains
in interface Set<OptionEntry>
contains
in class AbstractCollection<OptionEntry>
public 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 object)
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 String toString()
toString
in class AbstractCollection<OptionEntry>
public void addXml(Element element, long flags)
element
- the element to add the option tags toflags
- not used for now
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |