|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.model.FreeColObject
public abstract class FreeColObject
| Field Summary | |
|---|---|
protected static java.lang.String |
ARRAY_SIZE
XML tag name for array elements. |
private java.lang.String |
id
Unique identifier of an object |
protected static java.lang.String |
ID_ATTRIBUTE
XML tag name for ID attribute. |
static java.lang.String |
ID_ATTRIBUTE_TAG
|
protected static java.util.logging.Logger |
logger
|
protected static java.lang.String |
PARTIAL_ATTRIBUTE
XML attribute tag to denote partial updates. |
private java.beans.PropertyChangeSupport |
pcs
|
| Constructor Summary | |
|---|---|
FreeColObject()
|
|
| Method Summary | ||
|---|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
|
|
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
|
|
void |
fireIndexedPropertyChange(java.lang.String propertyName,
int index,
boolean oldValue,
boolean newValue)
|
|
void |
fireIndexedPropertyChange(java.lang.String propertyName,
int index,
int oldValue,
int newValue)
|
|
void |
fireIndexedPropertyChange(java.lang.String propertyName,
int index,
java.lang.Object oldValue,
java.lang.Object newValue)
|
|
void |
firePropertyChange(java.beans.PropertyChangeEvent event)
|
|
void |
firePropertyChange(java.lang.String propertyName,
boolean oldValue,
boolean newValue)
|
|
void |
firePropertyChange(java.lang.String propertyName,
int oldValue,
int newValue)
|
|
void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
|
|
boolean |
getAttribute(javax.xml.stream.XMLStreamReader in,
java.lang.String attributeName,
boolean defaultValue)
Return an attribute value or the default value. |
|
float |
getAttribute(javax.xml.stream.XMLStreamReader in,
java.lang.String attributeName,
float defaultValue)
Return an attribute value or the default value. |
|
int |
getAttribute(javax.xml.stream.XMLStreamReader in,
java.lang.String attributeName,
int defaultValue)
Return an attribute value or the default value. |
|
java.lang.String |
getAttribute(javax.xml.stream.XMLStreamReader in,
java.lang.String attributeName,
java.lang.String defaultValue)
Return an attribute value or the default value. |
|
java.lang.String |
getId()
Get the Id value. |
|
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners()
|
|
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners(java.lang.String propertyName)
|
|
static java.lang.String |
getXMLElementTagName()
Gets the tag name used to serialize this object, generally the class name starting with a lower case letter. |
|
boolean |
hasAbility(java.lang.String id)
Describe hasAbility method here. |
|
boolean |
hasAttribute(javax.xml.stream.XMLStreamReader in,
java.lang.String attributeName)
Return an attribute value or the default value. |
|
boolean |
hasListeners(java.lang.String propertyName)
|
|
protected void |
readAttributes(javax.xml.stream.XMLStreamReader in)
|
|
protected void |
readChildren(javax.xml.stream.XMLStreamReader in)
|
|
protected
|
readFromArrayElement(java.lang.String tagName,
javax.xml.stream.XMLStreamReader in,
java.lang.Class<T> type)
Reads an XML-representation of an array. |
|
protected int[] |
readFromArrayElement(java.lang.String tagName,
javax.xml.stream.XMLStreamReader in,
int[] arrayType)
Reads an XML-representation of an array. |
|
protected java.lang.String[] |
readFromArrayElement(java.lang.String tagName,
javax.xml.stream.XMLStreamReader in,
java.lang.String[] arrayType)
Reads an XML-representation of an array. |
|
protected
|
readFromListElement(java.lang.String tagName,
javax.xml.stream.XMLStreamReader in,
java.lang.Class<T> type)
Reads an XML-representation of a list. |
|
void |
readFromXML(javax.xml.stream.XMLStreamReader in)
Initializes this object from an XML-representation of this object, unless the PARTIAL_ATTRIBUTE tag is present which indicates a partial update of an existing object. |
|
void |
readFromXMLElement(org.w3c.dom.Element element)
Initialize this object from an XML-representation of this object. |
|
protected void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Initialize this object from an XML-representation of this object. |
|
protected void |
readFromXMLPartialImpl(javax.xml.stream.XMLStreamReader in)
Updates this object from an XML-representation of this object. |
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
|
|
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
|
|
protected void |
setId(java.lang.String newId)
Set the Id value. |
|
protected void |
toArrayElement(java.lang.String tagName,
int[] array,
javax.xml.stream.XMLStreamWriter out)
Creates an XML-representation of an array. |
|
protected
|
toArrayElement(java.lang.String tagName,
T[] array,
javax.xml.stream.XMLStreamWriter out)
Creates an XML-representation of an array. |
|
protected
|
toListElement(java.lang.String tagName,
java.util.List<T> array,
javax.xml.stream.XMLStreamWriter out)
Creates an XML-representation of a list. |
|
void |
toXML(javax.xml.stream.XMLStreamWriter out)
This method writes an XML-representation of this object to the given stream. |
|
void |
toXML(javax.xml.stream.XMLStreamWriter out,
Player player)
This method writes an XML-representation of this object to the given stream. |
|
void |
toXML(javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame)
This method writes an XML-representation of this object to the given stream. |
|
org.w3c.dom.Element |
toXMLElement(org.w3c.dom.Document document)
This method writes an XML-representation of this object to the given stream. |
|
org.w3c.dom.Element |
toXMLElement(Player player,
org.w3c.dom.Document document)
This method writes an XML-representation of this object to the given stream. |
|
org.w3c.dom.Element |
toXMLElement(Player player,
org.w3c.dom.Document document,
boolean showAll,
boolean toSavedGame)
This method writes an XML-representation of this object to the given stream. |
|
org.w3c.dom.Element |
toXMLElement(Player player,
org.w3c.dom.Document document,
boolean showAll,
boolean toSavedGame,
java.lang.String[] fields)
This method writes an XML-representation of this object to the given stream. |
|
org.w3c.dom.Element |
toXMLElementPartial(org.w3c.dom.Document document,
java.lang.String... fields)
This method writes a partial XML-representation of this object to an element using only the mandatory and specified fields. |
|
protected abstract void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
This method writes an XML-representation of this object to the given stream. |
|
protected void |
toXMLPartialImpl(javax.xml.stream.XMLStreamWriter out,
java.lang.String[] fields)
This method writes a partial XML-representation of this object to the given stream using only the mandatory and specified fields. |
|
void |
writeAttribute(javax.xml.stream.XMLStreamWriter out,
java.lang.String attributeName,
FreeColObject object)
Write an ID attribute if object is not null. |
|
protected void |
writeAttributes(javax.xml.stream.XMLStreamWriter out)
|
|
protected void |
writeChildren(javax.xml.stream.XMLStreamWriter out)
|
|
void |
writeFreeColGameObject(FreeColGameObject object,
javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static java.util.logging.Logger logger
protected static final java.lang.String ID_ATTRIBUTE
public static final java.lang.String ID_ATTRIBUTE_TAG
protected static final java.lang.String ARRAY_SIZE
protected static final java.lang.String PARTIAL_ATTRIBUTE
private java.lang.String id
private java.beans.PropertyChangeSupport pcs
| Constructor Detail |
|---|
public FreeColObject()
| Method Detail |
|---|
public java.lang.String getId()
Id value.
String valueprotected void setId(java.lang.String newId)
Id value.
newId - The new Id value.public boolean hasAbility(java.lang.String id)
hasAbility method here.
id - a String value
boolean valuepublic org.w3c.dom.Element toXMLElement(org.w3c.dom.Document document)
document - The Document.
public org.w3c.dom.Element toXMLElement(Player player,
org.w3c.dom.Document document)
Player will
be added to that representation if showAll is
set to false.
player - The Player this XML-representation
should be made for, or null if
showAll == true.document - The Document.
public org.w3c.dom.Element toXMLElement(Player player,
org.w3c.dom.Document document,
boolean showAll,
boolean toSavedGame)
Player will
be added to that representation if showAll is
set to false.
player - The Player this XML-representation
should be made for, or null if
showAll == true.document - The Document.showAll - Only attributes visible to player
will be added to the representation if showAll
is set to false.toSavedGame - If true then information that
is only needed when saving a game is added.
public org.w3c.dom.Element toXMLElementPartial(org.w3c.dom.Document document,
java.lang.String... fields)
document - The Document.fields - The fields to write.
public org.w3c.dom.Element toXMLElement(Player player,
org.w3c.dom.Document document,
boolean showAll,
boolean toSavedGame,
java.lang.String[] fields)
Player will
be added to that representation if showAll is
set to false.
player - The Player this XML-representation
should be made for, or null if
showAll == true.document - The Document.showAll - Only attributes visible to player
will be added to the representation if showAll
is set to false.toSavedGame - If true then information that
is only needed when saving a game is added.fields - An array of field names, which if non-null
indicates this should be a partial write.
public void toXML(javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame)
throws javax.xml.stream.XMLStreamException
Player will
be added to that representation if showAll is
set to false.
out - The target stream.player - The Player this XML-representation
should be made for, or null if
showAll == true.showAll - Only attributes visible to player
will be added to the representation if showAll
is set to false.toSavedGame - If true then information that
is only needed when saving a game is added.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
public void toXML(javax.xml.stream.XMLStreamWriter out,
Player player)
throws javax.xml.stream.XMLStreamException
Player will be added to that representation.
out - The target stream.player - The Player this XML-representation is
made for.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.toXML(XMLStreamWriter, Player, boolean, boolean)
public void toXML(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
out - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.toXML(XMLStreamWriter, Player, boolean, boolean)public void readFromXMLElement(org.w3c.dom.Element element)
element - An XML-element that will be used to initialize
this object.
public void readFromXML(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
in - The input stream with the XML.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected int[] readFromArrayElement(java.lang.String tagName,
javax.xml.stream.XMLStreamReader in,
int[] arrayType)
throws javax.xml.stream.XMLStreamException
tagName - The tagname for the Element
representing the array.in - The input stream with the XML.arrayType - The type of array to be read.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
protected <T> T[] readFromArrayElement(java.lang.String tagName,
javax.xml.stream.XMLStreamReader in,
java.lang.Class<T> type)
throws javax.xml.stream.XMLStreamException
tagName - The tagname for the Element
representing the array.in - The input stream with the XML.type - The type of the elements to be read. This type
needs to have a constructor accepting a single
String.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
protected <T> void toArrayElement(java.lang.String tagName,
T[] array,
javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
tagName - The tagname for the Element
representing the array.array - The array to represent.out - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void toArrayElement(java.lang.String tagName,
int[] array,
javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
tagName - The tagname for the Element
representing the array.array - The array to represent.out - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected <T> void toListElement(java.lang.String tagName,
java.util.List<T> array,
javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
tagName - The tagname for the Element
representing the array.array - The array to represent.out - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected <T> java.util.List<T> readFromListElement(java.lang.String tagName,
javax.xml.stream.XMLStreamReader in,
java.lang.Class<T> type)
throws javax.xml.stream.XMLStreamException
tagName - The tagname for the Element
representing the array.in - The input stream with the XML.type - The type of the items to be added. This type
needs to have a constructor accepting a single
String.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
protected java.lang.String[] readFromArrayElement(java.lang.String tagName,
javax.xml.stream.XMLStreamReader in,
java.lang.String[] arrayType)
throws javax.xml.stream.XMLStreamException
tagName - The tagname for the Element
representing the array.in - The input stream with the XML.arrayType - The type of array to be read.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
public boolean hasAttribute(javax.xml.stream.XMLStreamReader in,
java.lang.String attributeName)
in - a XMLStreamReader valueattributeName - An attribute name
int value
public int getAttribute(javax.xml.stream.XMLStreamReader in,
java.lang.String attributeName,
int defaultValue)
in - a XMLStreamReader valueattributeName - An attribute namedefaultValue - an int value
int value
public float getAttribute(javax.xml.stream.XMLStreamReader in,
java.lang.String attributeName,
float defaultValue)
in - a XMLStreamReader valueattributeName - An attribute namedefaultValue - a float value
int value
public boolean getAttribute(javax.xml.stream.XMLStreamReader in,
java.lang.String attributeName,
boolean defaultValue)
in - a XMLStreamReader valueattributeName - An attribute namedefaultValue - a boolean value
boolean value
public java.lang.String getAttribute(javax.xml.stream.XMLStreamReader in,
java.lang.String attributeName,
java.lang.String defaultValue)
in - a XMLStreamReader valueattributeName - An attribute namedefaultValue - an String value
String value
public void writeAttribute(javax.xml.stream.XMLStreamWriter out,
java.lang.String attributeName,
FreeColObject object)
throws javax.xml.stream.XMLStreamException
out - a XMLStreamWriter valueattributeName - a String valueobject - a FreeColObject value
javax.xml.stream.XMLStreamException - if an error occurs
public void writeFreeColGameObject(FreeColGameObject object,
javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
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
javax.xml.stream.XMLStreamException
protected void readChildren(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void readFromXMLPartialImpl(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
in - The input stream with the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
protected abstract void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
out - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void toXMLPartialImpl(javax.xml.stream.XMLStreamWriter out,
java.lang.String[] fields)
throws javax.xml.stream.XMLStreamException
out - The target stream.fields - The fields to write.
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
javax.xml.stream.XMLStreamException
protected void writeChildren(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public void addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
public void fireIndexedPropertyChange(java.lang.String propertyName,
int index,
boolean oldValue,
boolean newValue)
public void fireIndexedPropertyChange(java.lang.String propertyName,
int index,
int oldValue,
int newValue)
public void fireIndexedPropertyChange(java.lang.String propertyName,
int index,
java.lang.Object oldValue,
java.lang.Object newValue)
public void firePropertyChange(java.beans.PropertyChangeEvent event)
public void firePropertyChange(java.lang.String propertyName,
boolean oldValue,
boolean newValue)
public void firePropertyChange(java.lang.String propertyName,
int oldValue,
int newValue)
public void firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
public boolean hasListeners(java.lang.String propertyName)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
public static java.lang.String getXMLElementTagName()
null.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||