|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.electrotank.electroserver4.extensions.api.value.EsObject
public class EsObject
EsObject facilitates the exchange of data between all layers of a multiplayer application.
EsObject is an object that supports a large number of data types. It allows the server and client, or clients and other clients, to exchange simple or complex object structures that retain data types. In addition, EsObjects are used in many places when dealing with extensions and values for room variables, user variables, and user server variables.
One of the most attractive benefits of an EsObject is that it allows for data to be sent across languages cleanly and easily. A plugin written in ActionScript can create an EsObject and send it to a Java client and both sides will treat it consistently. There is no need to perform any messy conversions. For example: A Flash client can create an EsObject, populate it with strings, numbers and arrays of information, and then just send it to a server plugin. The plugin receives this EsObject and can access all of that information.
EsObjectEntry,
EsObjectRO,
Serialized Form| Field Summary | |
|---|---|
static EsObjectRO |
emptyObject
|
| Constructor Summary | |
|---|---|
EsObject()
Creates a new instance of EsObject |
|
EsObject(Object... entries)
Creates a new instance of EsObject and fills it with the entries in the Object. |
|
| Method Summary | |
|---|---|
void |
addAll(EsObjectRO esObject)
Adds the contents of the argument. |
void |
fromXML(Node variablesNode,
XPath xpath)
|
boolean |
getBoolean(String name)
Gets the boolean value of the named entry. |
boolean |
getBoolean(String name,
boolean defaultValue)
Gets the boolean value of the named entry, or the default value if any exception occurs. |
boolean[] |
getBooleanArray(String name)
Gets the boolean array value of the named entry. |
boolean[] |
getBooleanArray(String name,
boolean[] defaultValue)
Gets the boolean array value of the named entry, or the default value if any exception occurs. |
byte |
getByte(String name)
Gets the byte value of the named entry. |
byte |
getByte(String name,
byte defaultValue)
Gets the byte value of the named entry, or the default value if any exception occurs. |
byte[] |
getByteArray(String name)
Gets the byte array value of the named entry. |
byte[] |
getByteArray(String name,
byte[] defaultValue)
Gets the byte array value of the named entry, or the default value if any exception occurs. |
char |
getChar(String name)
Gets the char value of the named entry. |
char |
getChar(String name,
char defaultValue)
Gets the char value of the named entry, or the default value if any exception occurs. |
char[] |
getCharArray(String name)
Gets the char array value of the named entry. |
char[] |
getCharArray(String name,
char[] defaultValue)
Gets the char array value of the named entry, or the default value if any exception occurs. |
double |
getDouble(String name)
Gets the double value of the named entry. |
double |
getDouble(String name,
double defaultValue)
Gets the double value of the named entry, or the default value if any exception occurs. |
double[] |
getDoubleArray(String name)
Gets the double array value of the named entry. |
double[] |
getDoubleArray(String name,
double[] defaultValue)
Gets the double array value of the named entry, or the default value if any exception occurs. |
EsObject |
getEsObject(String name)
Gets the EsObject value of the named entry. |
EsObject |
getEsObject(String name,
EsObject defaultValue)
Gets the EsObject value of the named entry, or the default value if any exception occurs. |
EsObject[] |
getEsObjectArray(String name)
Gets the EsObject array value of the named entry. |
EsObject[] |
getEsObjectArray(String name,
EsObject[] defaultValue)
Gets the EsObject array value of the named entry, or the default value if any exception occurs. |
float |
getFloat(String name)
Gets the float value of the named entry. |
float |
getFloat(String name,
float defaultValue)
Gets the float value of the named entry, or the default value if any exception occurs. |
float[] |
getFloatArray(String name)
Gets the float array value of the named entry. |
float[] |
getFloatArray(String name,
float[] defaultValue)
Gets the float array value of the named entry, or the default value if any exception occurs. |
int |
getInteger(String name)
Gets the integer value of the named entry. |
int |
getInteger(String name,
int defaultValue)
Gets the integer value of the named entry, or the default value if any exception occurs. |
int[] |
getIntegerArray(String name)
Gets the int array value of the named entry. |
int[] |
getIntegerArray(String name,
int[] defaultValue)
Gets the int array value of the named entry, or the default value if any exception occurs. |
long |
getLong(String name)
Gets the long value of the named entry. |
long |
getLong(String name,
long defaultValue)
Gets the long value of the named entry, or the default value if any exception occurs. |
long[] |
getLongArray(String name)
Gets the long array value of the named entry. |
long[] |
getLongArray(String name,
long[] defaultValue)
Gets the long array value of the named entry, or the default value if any exception occurs. |
Number |
getNumber(String name)
Gets the Number value of the named entry. |
Number |
getNumber(String name,
Number defaultValue)
Gets the Number value of the named entry, or the default value if any exception occurs. |
Number[] |
getNumberArray(String name)
Gets the Number array value of the named entry. |
Number[] |
getNumberArray(String name,
Number[] defaultValue)
Gets the Number array value of the named entry, or the default value if any exception occurs. |
Object |
getRawVariable(String name)
Gets the raw value of the named variable, as an Object. |
short |
getShort(String name)
Gets the short value of the named entry. |
short |
getShort(String name,
short defaultValue)
Gets the short value of the named entry, or the default value if any exception occurs. |
short[] |
getShortArray(String name)
Gets the short array value of the named entry. |
short[] |
getShortArray(String name,
short[] defaultValue)
Gets the short array value of the named entry, or the default value if any exception occurs. |
int |
getSize()
Gets the number of values stored in the EsObject. |
String |
getString(String name)
Gets the string value of the named entry. |
String |
getString(String name,
String defaultValue)
Gets the String value of the named entry, or the default value if any exception occurs. |
String[] |
getStringArray(String name)
Gets the string array value of the named entry. |
String[] |
getStringArray(String name,
String[] defaultValue)
Gets the string array value of the named entry, or the default value if any exception occurs. |
Iterator<EsObjectEntry> |
iterator()
Creates an iterator over all the entries in the EsObject. |
void |
removeAll()
Removes all variables from the EsObject, leaving it empty. |
void |
removeVariable(String name)
Removes the named variable from the EsObject. |
void |
setBoolean(String name,
boolean value)
Sets the named entry of the EsObject to the boolean value. |
void |
setBooleanArray(String name,
boolean[] value)
Sets the named entry of the EsObject to the boolean array value. |
void |
setByte(String name,
byte value)
Sets the named entry of the EsObject to the byte value. |
void |
setByteArray(String name,
byte[] value)
Sets the named entry of the EsObject to the byte array value. |
void |
setChar(String name,
char value)
Sets the named entry of the EsObject to the char value. |
void |
setCharArray(String name,
char[] value)
Sets the named entry of the EsObject to the char array value. |
void |
setDouble(String name,
double value)
Sets the named entry of the EsObject to the double value. |
void |
setDoubleArray(String name,
double[] value)
Sets the named entry of the EsObject to the double array value. |
void |
setEsObject(String name,
EsObject value)
Sets the named entry of the EsObject to the EsObject value. |
void |
setEsObjectArray(String name,
EsObject[] value)
Sets the named entry of the EsObject to the EsObject array value. |
void |
setFloat(String name,
float value)
Sets the named entry of the EsObject to the float value. |
void |
setFloatArray(String name,
float[] value)
Sets the named entry of the EsObject to the float array value. |
void |
setInteger(String name,
int value)
Sets the named entry of the EsObject to the integer value. |
void |
setIntegerArray(String name,
int[] value)
Sets the named entry of the EsObject to the int array value. |
void |
setLong(String name,
long value)
Sets the named entry of the EsObject to the long value. |
void |
setLongArray(String name,
long[] value)
Sets the named entry of the EsObject to the long array value. |
void |
setNumber(String name,
double value)
Sets the named entry of the EsObject to the double value, cast as a Number. |
void |
setNumber(String name,
float value)
Sets the named entry of the EsObject to the float value, cast as a Number. |
void |
setNumber(String name,
int value)
Sets the named entry of the EsObject to the int value, cast as a Number. |
void |
setNumber(String name,
long value)
Sets the named entry of the EsObject to the long value, cast as a Number. |
void |
setNumber(String name,
Number value)
Sets the named entry of the EsObject to the Number value. |
void |
setNumberArray(String name,
Number[] value)
Sets the named entry of the EsObject to the Number array value. |
void |
setShort(String name,
short value)
Sets the named entry of the EsObject to the short value. |
void |
setShortArray(String name,
short[] value)
Sets the named entry of the EsObject to the short array value. |
void |
setString(String name,
String value)
Sets the named entry of the EsObject to the string value. |
void |
setStringArray(String name,
String[] value)
Sets the named entry of the EsObject to the string array value. |
String |
toString()
|
String |
toString(String tabs)
|
String |
toXML()
|
boolean |
variableExists(String name)
Returns true if an entry exists with the given name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final EsObjectRO emptyObject
| Constructor Detail |
|---|
public EsObject()
public EsObject(Object... entries)
entries - the names and values to add to the EsObject| Method Detail |
|---|
public Iterator<EsObjectEntry> iterator()
iterator in interface Iterable<EsObjectEntry>EsObjectEntrypublic void addAll(EsObjectRO esObject)
esObject - the read-only EsObject to be added.EsObjectROpublic int getSize()
EsObjectRO
getSize in interface EsObjectRO
public void setInteger(String name,
int value)
name - name of the entryvalue - integer value of the entry
public void setString(String name,
String value)
name - name of the entryvalue - String value of the entry
public void setDouble(String name,
double value)
name - name of the entryvalue - double value of the entry
public void setFloat(String name,
float value)
name - name of the entryvalue - float value of the entry
public void setBoolean(String name,
boolean value)
name - name of the entryvalue - boolean value of the entry
public void setByte(String name,
byte value)
name - name of the entryvalue - byte value of the entry
public void setChar(String name,
char value)
name - name of the entryvalue - char value of the entry
public void setLong(String name,
long value)
name - name of the entryvalue - long value of the entry
public void setShort(String name,
short value)
name - name of the entryvalue - short value of the entry
public void setEsObject(String name,
EsObject value)
name - name of the entryvalue - short value of the entry
public void setNumber(String name,
Number value)
name - name of the entryvalue - Number value of the entry
public void setNumber(String name,
double value)
name - name of the entryvalue - double value of the entry
public void setNumber(String name,
float value)
name - name of the entryvalue - float value of the entry
public void setNumber(String name,
long value)
name - name of the entryvalue - long value of the entry
public void setNumber(String name,
int value)
name - name of the entryvalue - int value of the entry
public void setIntegerArray(String name,
int[] value)
name - name of the entryvalue - int array value of the entry
public void setStringArray(String name,
String[] value)
name - name of the entryvalue - string array value of the entry
public void setDoubleArray(String name,
double[] value)
name - name of the entryvalue - double array value of the entry
public void setFloatArray(String name,
float[] value)
name - name of the entryvalue - float array value of the entry
public void setBooleanArray(String name,
boolean[] value)
name - name of the entryvalue - boolean array value of the entry
public void setByteArray(String name,
byte[] value)
name - name of the entryvalue - byte array value of the entry
public void setCharArray(String name,
char[] value)
name - name of the entryvalue - char array value of the entry
public void setLongArray(String name,
long[] value)
name - name of the entryvalue - long array value of the entry
public void setShortArray(String name,
short[] value)
name - name of the entryvalue - short array value of the entry
public void setEsObjectArray(String name,
EsObject[] value)
name - name of the entryvalue - EsObject array value of the entry
public void setNumberArray(String name,
Number[] value)
name - name of the entryvalue - Number array value of the entrypublic int getInteger(String name)
EsObjectRO
getInteger in interface EsObjectROname - name of the entry
public int getInteger(String name,
int defaultValue)
EsObjectRO
getInteger in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public String getString(String name)
EsObjectRO
getString in interface EsObjectROname - name of the entry
public String getString(String name,
String defaultValue)
EsObjectRO
getString in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public double getDouble(String name)
EsObjectRO
getDouble in interface EsObjectROname - name of the entry
public double getDouble(String name,
double defaultValue)
EsObjectRO
getDouble in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public float getFloat(String name)
EsObjectRO
getFloat in interface EsObjectROname - name of the entry
public float getFloat(String name,
float defaultValue)
EsObjectRO
getFloat in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public boolean getBoolean(String name)
EsObjectRO
getBoolean in interface EsObjectROname - name of the entry
public boolean getBoolean(String name,
boolean defaultValue)
EsObjectRO
getBoolean in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public byte getByte(String name)
EsObjectRO
getByte in interface EsObjectROname - name of the entry
public byte getByte(String name,
byte defaultValue)
EsObjectRO
getByte in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public char getChar(String name)
EsObjectRO
getChar in interface EsObjectROname - name of the entry
public char getChar(String name,
char defaultValue)
EsObjectRO
getChar in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public long getLong(String name)
EsObjectRO
getLong in interface EsObjectROname - name of the entry
public long getLong(String name,
long defaultValue)
EsObjectRO
getLong in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public short getShort(String name)
EsObjectRO
getShort in interface EsObjectROname - name of the entry
public short getShort(String name,
short defaultValue)
EsObjectRO
getShort in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public EsObject getEsObject(String name)
EsObjectRO
getEsObject in interface EsObjectROname - name of the entry
public EsObject getEsObject(String name,
EsObject defaultValue)
EsObjectRO
getEsObject in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public Number getNumber(String name)
EsObjectRO
getNumber in interface EsObjectROname - name of the entry
public Number getNumber(String name,
Number defaultValue)
EsObjectRO
getNumber in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public int[] getIntegerArray(String name)
EsObjectRO
getIntegerArray in interface EsObjectROname - name of the entry
public int[] getIntegerArray(String name,
int[] defaultValue)
EsObjectRO
getIntegerArray in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public String[] getStringArray(String name)
EsObjectRO
getStringArray in interface EsObjectROname - name of the entry
public String[] getStringArray(String name,
String[] defaultValue)
EsObjectRO
getStringArray in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public double[] getDoubleArray(String name)
EsObjectRO
getDoubleArray in interface EsObjectROname - name of the entry
public double[] getDoubleArray(String name,
double[] defaultValue)
EsObjectRO
getDoubleArray in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public float[] getFloatArray(String name)
EsObjectRO
getFloatArray in interface EsObjectROname - name of the entry
public float[] getFloatArray(String name,
float[] defaultValue)
EsObjectRO
getFloatArray in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public boolean[] getBooleanArray(String name)
EsObjectRO
getBooleanArray in interface EsObjectROname - name of the entry
public boolean[] getBooleanArray(String name,
boolean[] defaultValue)
EsObjectRO
getBooleanArray in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public byte[] getByteArray(String name)
EsObjectRO
getByteArray in interface EsObjectROname - name of the entry
public byte[] getByteArray(String name,
byte[] defaultValue)
EsObjectRO
getByteArray in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public char[] getCharArray(String name)
EsObjectRO
getCharArray in interface EsObjectROname - name of the entry
public char[] getCharArray(String name,
char[] defaultValue)
EsObjectRO
getCharArray in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public long[] getLongArray(String name)
EsObjectRO
getLongArray in interface EsObjectROname - name of the entry
public long[] getLongArray(String name,
long[] defaultValue)
EsObjectRO
getLongArray in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public short[] getShortArray(String name)
EsObjectRO
getShortArray in interface EsObjectROname - name of the entry
public short[] getShortArray(String name,
short[] defaultValue)
EsObjectRO
getShortArray in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public EsObject[] getEsObjectArray(String name)
EsObjectRO
getEsObjectArray in interface EsObjectROname - name of the entry
public EsObject[] getEsObjectArray(String name,
EsObject[] defaultValue)
EsObjectRO
getEsObjectArray in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public Number[] getNumberArray(String name)
EsObjectRO
getNumberArray in interface EsObjectROname - name of the entry
public Number[] getNumberArray(String name,
Number[] defaultValue)
EsObjectRO
getNumberArray in interface EsObjectROname - name of the entrydefaultValue - value to return if an exception occurs
public void removeVariable(String name)
name - name of variable to be removedpublic void removeAll()
public Object getRawVariable(String name)
EsObjectRO
getRawVariable in interface EsObjectROname - name of the variable
public boolean variableExists(String name)
EsObjectRO
variableExists in interface EsObjectROname - name of the variable
public String toString()
toString in class Objectpublic String toString(String tabs)
public String toXML()
public void fromXML(Node variablesNode,
XPath xpath)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||