|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DataHandler
IMPORTANT NOTE: implementations should be synchronised.
This is a Data-Type interface for an indexed and labelled array
of Objects similar to the PHP array concept.
Data should be stored with a String label.
Originally designed for handling resultSet data and query building in database intensive desktop applications.
Field Summary | |
---|---|
static java.lang.String |
VERSION
|
Method Summary | |
---|---|
void |
addData(java.lang.String n,
java.lang.Object d)
Adds Elements to this DataHandler Object. If the key is null or the equivalent of, the Element will not be added to this DataHandler. NOTE: Use setData(String n, Object d) to modify existing data by keyor setData(int i, Object d) to modify existing data by index. |
void |
clearData()
Resets this DataHandler. |
int |
countMatches(java.lang.String n)
Counts the Elements with key names matching name n in this DataHandler. |
java.lang.Object |
getData(int i)
Alias function for getObject(int i) |
java.lang.Object |
getData(java.lang.String n)
Alias function for getObject(String n) |
double |
getDouble(int i)
Get the value at index i as a Double or throw an error if the data is not valid for this java Type. |
double |
getDouble(java.lang.String n)
Get the value at name n as a Double or throw an error if the data is not valid for this java Type. |
float |
getFloat(int i)
Get the value at index i as a Float or throw an error if the data is not valid for this java Type. |
float |
getFloat(java.lang.String n)
Get the value at name n as a Float or throw an error if the data is not valid for this java Type. |
int |
getIndex(java.lang.String n)
Get a keys index in this set from its name String |
int |
getIndexByElement(java.lang.String key,
java.lang.String data)
|
int[] |
getIndexes(java.lang.String n)
Get all key indexes in this set from a key name String. |
int |
getInt(int i)
Get the value at index i as an Integer or throw an error if the data is not valid for this java Type. |
int |
getInt(java.lang.String n)
Get the value at name n as an Integer or throw an error if the data is not valid for this java Type. |
java.lang.String |
getKey(int i)
Get the keys name at index i. |
long |
getLong(int i)
Get the value at index i as a Long or throw an error if the data is not valid for this java Type. |
long |
getLong(java.lang.String n)
Get the value at name n as a Long or throw an error if the data is not valid for this java Type. |
java.lang.Object |
getObject(int i)
Get the Object at column index i. |
java.lang.Object |
getObject(java.lang.String n)
Get the Object at column name n. |
java.lang.Object |
getObjectByElement(java.lang.String key,
java.lang.String data)
|
java.lang.Short |
getShort(int i)
Get the value at index i as a Short or throw an error if the data is not valid for this java Type. |
java.lang.Short |
getShort(java.lang.String n)
Get the value at name n as a Short or throw an error if the data is not valid for this java Type. |
java.lang.String |
getString(int i)
Get the Object at column index i as a String. |
java.lang.String |
getString(java.lang.String n)
Get the Object at column name n as a String. |
boolean |
hasData(java.lang.String value)
Does this data exist in the set? The usefulness of this function is questionable. |
boolean |
hasElement(java.lang.String key,
java.lang.String data)
Does this DataHandler Element exist in the set? |
boolean |
hasKey(int index)
Does this key exist in the set? |
boolean |
hasKey(java.lang.String value)
Does this key exist in the set? |
boolean |
isEmpty()
Determines if this DataHandler contains Elements. |
int |
length()
Count all Elements in this DataHandler. |
void |
removeByIndex(int i)
Removes the Element at index and shrinks this DataHandler so that Element index+1 will be positioned at index after the original Element at index is removed. |
void |
removeByKey(java.lang.String n)
Removes the Element at name n and shrinks this DataHandler by one Element. |
void |
setData(int i,
java.lang.Object d)
Update the Element at index i with data d. No action is taken if index i is greater than this DataHandlers size. |
void |
setData(int index,
java.lang.String newKey,
java.lang.Object newObj)
Update the Element at index with a new key and new data. No action is taken if index is greater than this DataHandlers size. |
void |
setData(java.lang.String n,
java.lang.Object d)
Update the Element at name n with data d or add a new Element if key name n doesnt exist. USE: addData(String n, Object d) to add new data or data with duplicate keys to this DataHandler. |
void |
setData(java.lang.String key,
java.lang.String newKey,
java.lang.Object newObj)
Update the Element at name key with a new key and new data or add a new Element if name key doesnt exist. NOTE: Use addData(String n, Object d) to add new data or data with duplicate keys to this DataHandler. |
Field Detail |
---|
static final java.lang.String VERSION
Method Detail |
---|
void addData(java.lang.String n, java.lang.Object d)
setData(String n, Object d)
to modify existing data by keysetData(int i, Object d)
to modify existing data by index.
n
- String - key named
- Object - data to add to this DataHandler.void clearData()
int countMatches(java.lang.String n)
n
- The keys name to seek
boolean hasData(java.lang.String value)
value
- data to search the set for.
boolean hasKey(java.lang.String value)
value
- key to search the set for.
boolean hasKey(int index)
index
- key index to search the set for.
boolean hasElement(java.lang.String key, java.lang.String data)
key
- The Elements key Stringdata
- The Elements data Object as a String
java.lang.Object getObjectByElement(java.lang.String key, java.lang.String data)
key
- The keys name to locatedata
- The data to find a match for
int getIndexByElement(java.lang.String key, java.lang.String data)
key
- The keys name to locatedata
- The data to find a match for
java.lang.Object getData(int i)
i
- int - keys index
java.lang.Object getData(java.lang.String n)
n
- String - key name
int getIndex(java.lang.String n)
n
- String - keys name
int[] getIndexes(java.lang.String n)
n
- String - key name
double getDouble(int i) throws IlegalNumberTypeException
i
- The columns index to seek.
IlegalNumberTypeException
- if value at i is not a Double.double getDouble(java.lang.String n) throws IlegalNumberTypeException
n
- The columns name to seek.
IlegalNumberTypeException
- if value at n is not a Double.int getInt(int i) throws IlegalNumberTypeException
i
- The columns index to seek.
IlegalNumberTypeException
- if value at i is not an Integer.int getInt(java.lang.String n) throws IlegalNumberTypeException
n
- The columns name to seek.
IlegalNumberTypeException
- if value at n is not an Integer.java.lang.String getKey(int i)
i
- The columns index to seek.
int length()
java.lang.String getString(int i)
i
- The columns index to seek.
java.lang.String getString(java.lang.String n)
n
- The columns name to seek.
float getFloat(int i) throws IlegalNumberTypeException
i
- The columns index to seek.
IlegalNumberTypeException
- if value at i is not a Float.float getFloat(java.lang.String n) throws IlegalNumberTypeException
n
- The columns name to seek.
IlegalNumberTypeException
- if value at n is not a Float.java.lang.Object getObject(int i)
i
- The columns index to seek.
java.lang.Object getObject(java.lang.String n)
n
- The columns name to seek.
long getLong(int i) throws IlegalNumberTypeException
i
- The columns index to seek.
IlegalNumberTypeException
- if value at i is not a Long.long getLong(java.lang.String n) throws IlegalNumberTypeException
n
- The columns name to seek.
IlegalNumberTypeException
- if value at i is not a Long.java.lang.Short getShort(int i) throws IlegalNumberTypeException
i
- The columns index to seek.
IlegalNumberTypeException
- if value at i is not a Short.java.lang.Short getShort(java.lang.String n) throws IlegalNumberTypeException
n
- The columns name to seek.
IlegalNumberTypeException
- if value at n is not a Short.boolean isEmpty()
void removeByIndex(int i)
i
- Element index to remove from this DataHandler.void removeByKey(java.lang.String n)
n
- Elements name to remove from this DataHandler.void setData(java.lang.String n, java.lang.Object d)
addData(String n, Object d)
to add new data or data with duplicate keys to this DataHandler.
n
- The Elements name.d
- the Data to update/add to this DataHandler.void setData(int i, java.lang.Object d)
i
- The Elements index.d
- the Data to update index i with.void setData(java.lang.String key, java.lang.String newKey, java.lang.Object newObj)
addData(String n, Object d)
to add new data or data with duplicate keys to this DataHandler.
key
- The first Element with name matching key.newKey
- the new key for the Element.newObj
- the Data to update the Element with.void setData(int index, java.lang.String newKey, java.lang.Object newObj)
index
- The Element at index we want to update.newKey
- the new key for the Element.newObj
- the Data to update the Element with.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |