|
|||||||||
| Home >> All >> org >> jdaemon >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.jdaemon.util
Class ArrayAccessor

java.lang.Objectorg.jdaemon.util.ArrayAccessor
- All Implemented Interfaces:
- Accessor
- public class ArrayAccessor
- extends java.lang.Object
- implements Accessor
- extends java.lang.Object
Accessor which allows items stored in an array to be given names and accessed via those names.
| Field Summary | |
private java.util.TreeMap |
map
Stores the mapping of names to array indices |
| Constructor Summary | |
ArrayAccessor(java.lang.String[] names)
Creates a new instance of ArrayAccessor given an array of names. |
|
| Method Summary | |
java.lang.Object |
getAttribute(java.lang.String name,
java.lang.Object aggregate)
Retrieves a named attribute from an object. |
java.lang.Object |
getAttribute(java.lang.String name,
java.lang.Object[] array)
Retrieves a named attribute from an array. |
java.util.Iterator |
getAttributeNames()
Get an iterator over all the attribute names understood by this Accessor. |
void |
setAttribute(java.lang.String name,
java.lang.Object[] array,
java.lang.Object value)
Set the value of a named attribute within an array. |
void |
setAttribute(java.lang.String name,
java.lang.Object aggregate,
java.lang.Object value)
Set the value of a named attribute within an object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
map
private java.util.TreeMap map
- Stores the mapping of names to array indices
| Constructor Detail |
ArrayAccessor
public ArrayAccessor(java.lang.String[] names)
- Creates a new instance of ArrayAccessor given an array of names.
If name ith String in the array of names used to construct an ArrayAccessor accessor,
and objects is an array of java objects, then:
accessor.getAttribute(name, objects) == objects[i]
| Method Detail |
getAttribute
public java.lang.Object getAttribute(java.lang.String name, java.lang.Object[] array) throws java.lang.IllegalArgumentException
- Retrieves a named attribute from an array.
If name is the ith String in the array of names
used to construct this ArrayAccessor, then:
accessor.getAttribute(name, array) == array[i]
getAttribute
public java.lang.Object getAttribute(java.lang.String name, java.lang.Object aggregate) throws java.lang.IllegalArgumentException
- Retrieves a named attribute from an object.
aggregate must be an array. If name is the ith String in the array of names
used to construct this ArrayAccessor, then:
accessor.getAttribute(name, aggregate) == aggregate[i]- Specified by:
getAttributein interfaceAccessor
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object[] array, java.lang.Object value) throws java.lang.IllegalArgumentException
- Set the value of a named attribute within an array.
If name is the ith String in the array of names
used to construct this ArrayAccessor, then:
are equivalent.accessor.setAttribute(name, array, value)andarray[i] = value
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object aggregate, java.lang.Object value) throws java.lang.IllegalArgumentException
- Set the value of a named attribute within an object.
aggregate must be an array. If name is the ith String in the array of names
used to construct this ArrayAccessor, then:
are equivalent.accessor.setAttribute(name, aggregate, value)andaggregate[i] = value- Specified by:
setAttributein interfaceAccessor
getAttributeNames
public java.util.Iterator getAttributeNames()
- Get an iterator over all the attribute names understood by this Accessor.
- Specified by:
getAttributeNamesin interfaceAccessor
|
|||||||||
| Home >> All >> org >> jdaemon >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.jdaemon.util.ArrayAccessor