|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.option.AbstractOption<java.lang.String>
net.sf.freecol.common.option.StringOption
public class StringOption
Represents an option that can be an arbitrary string.
| Field Summary | |
|---|---|
private java.util.List<java.lang.String> |
choices
A list of choices to provide to the UI. |
private static java.util.logging.Logger |
logger
|
private java.lang.String |
value
The option value. |
| Fields inherited from class net.sf.freecol.common.option.AbstractOption |
|---|
isDefined |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG |
| Constructor Summary | |
|---|---|
StringOption(Specification specification)
Creates a new StringOption. |
|
StringOption(java.lang.String id)
Creates a new StringOption. |
|
StringOption(java.lang.String id,
Specification specification)
Creates a new StringOption. |
|
| Method Summary | |
|---|---|
StringOption |
clone()
|
java.util.List<java.lang.String> |
getChoices()
Get the Choices value. |
java.lang.String |
getValue()
Gets the current value of this StringOption. |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
protected void |
readAttributes(javax.xml.stream.XMLStreamReader in)
Reads the attributes of this object from an XML stream. |
protected void |
readChild(javax.xml.stream.XMLStreamReader in)
Reads a single child object. |
protected void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Initialize this object from an XML-representation of this object. |
void |
setChoices(java.util.List<java.lang.String> newChoices)
Set the Choices value. |
void |
setValue(java.lang.String value)
Sets the current value of this StringOption. |
protected void |
setValue(java.lang.String valueString,
java.lang.String defaultValueString)
Sets the value of this Option from the given string representation. |
java.lang.String |
toString()
Returns a textual representation of this object. |
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
This method writes an XML-representation of this object to the given stream. |
protected void |
writeAttributes(javax.xml.stream.XMLStreamWriter out)
Write the attributes of this object to a stream. |
protected void |
writeChildren(javax.xml.stream.XMLStreamWriter out)
Write the children of this object to a stream. |
| Methods inherited from class net.sf.freecol.common.option.AbstractOption |
|---|
generateChoices, getGroup, isNullValueOK, readOption, setGroup, setValues |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.freecol.common.option.Option |
|---|
getId, readFromXML, toXML |
| Field Detail |
|---|
private static java.util.logging.Logger logger
private java.lang.String value
private java.util.List<java.lang.String> choices
| Constructor Detail |
|---|
public StringOption(java.lang.String id)
StringOption.
id - The identifier for this option. This is used when the object
should be found in an OptionGroup.public StringOption(Specification specification)
StringOption.
specification - The specification this option belongs
to. May be null.
public StringOption(java.lang.String id,
Specification specification)
StringOption.
id - The identifier for this option. This is used when the object
should be found in an OptionGroup.specification - The specification this option belongs
to. May be null.| Method Detail |
|---|
public StringOption clone()
clone in interface Option<java.lang.String>clone in class AbstractOption<java.lang.String>public java.lang.String getValue()
StringOption.
getValue in interface Option<java.lang.String>getValue in class AbstractOption<java.lang.String>public void setValue(java.lang.String value)
StringOption.
setValue in interface Option<java.lang.String>setValue in class AbstractOption<java.lang.String>value - The value.
protected void setValue(java.lang.String valueString,
java.lang.String defaultValueString)
setValue in class AbstractOption<java.lang.String>valueString - the string representation of the value of
this OptiondefaultValueString - the string representation of the
default value of this Optionpublic final java.util.List<java.lang.String> getChoices()
Choices value.
List valuepublic final void setChoices(java.util.List<java.lang.String> newChoices)
Choices value.
newChoices - The new Choices value.
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toXMLImpl in class FreeColObjectout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void writeAttributes(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
writeAttributes in class FreeColObjectout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing to
the stream.
protected void writeChildren(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
writeChildren in class FreeColObjectout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing to
the stream.
protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
AbstractOption
readFromXMLImpl in class AbstractOption<java.lang.String>in - The input stream with the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
protected void readAttributes(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readAttributes in class AbstractOption<java.lang.String>in - The XML input stream.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
protected void readChild(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readChild in class FreeColObjectin - The XML input stream.
javax.xml.stream.XMLStreamException - if an error occurspublic static java.lang.String getXMLElementTagName()
public java.lang.String toString()
Option
toString in interface Option<java.lang.String>toString in class java.lang.ObjectOption.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||