Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## sim.util
Class CollectionProperties

    java.lang.Object
      sim.util.Properties
          sim.util.CollectionProperties

All Implemented Interfaces:
  java.io.Serializable

    public class CollectionProperties

extends Properties

A simple class for examining the slots of Maps, Collections, Indexed, and arrays as if the slots were Java Bean Properties. Beware that Maps and non-List Collections perform O(n) scans just to give you the property you were looking for. Lists, Indexed, and arrays are always O(1).

You can easily create a CollectionProperties object by passing in the appropriate object to examine. From then on, you can get the number of "Properties" (in this case, objects in the set), and retrieve the "Name" and the value of each Property, plus other information.

This class allows you to set and get properties on the object via boxing the property (java.lang.Integer for int, for example). You can also pass in a String, and SimpleProperties will parse the appropriate value out of the string automatically without you having to bother checking the type. arrays, Maps, Indexed, and Lists can have property values set. Other Collections cannot have values set.

If any errors arise from generating the properties, setting them, or getting their values, then typically null is returned.

See Also:
  Serialized Form

Field Summary

Fields inherited from class sim.util.Properties
`object`

Constructor Summary
`CollectionProperties(java.lang.Object o)` Object can be a Collection, a List, a Map, an Indexed, or an array.

Method Summary
`protected java.lang.Object` | `_setValue(int index, java.lang.Object value)`
`java.lang.String` | `getName(int index)` Returns the name of the property at the given index.
`java.lang.Class` | `getType(int index)` Returns the Class (or for primitive objects, the primitive TYPE) of the property at the given index.
`java.lang.Object` | `getValue(int index)` Returns the value of the property at the given index.
`boolean` | `isReadWrite(int index)` Returns true if the property at the given index is both readable and writable (as opposed to read-only).
`boolean` | `isVolatile()` Returns true if the number or order of properties could change at any time
`int` | `numProperties()` Returns the number of properties discovered in the object.

Methods inherited from class sim.util.Properties
`betterToString, getDomain, getObject, getProperties, getProperties, getTypeConversion, isComposite, isHidden, setValue, setValue, typeToName`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CollectionProperties

    public CollectionProperties(java.lang.Object o)

  Object can be a Collection, a List, a Map, an Indexed, or an array.

Method Detail

### isVolatile

    public boolean isVolatile()

  Description copied from class: `Properties`
  Returns true if the number or order of properties could change at any time

  Specified by:
    `isVolatile` in class `Properties`

### numProperties

    public int numProperties()

  Description copied from class: `Properties`
  Returns the number of properties discovered in the object.

  Specified by:
    `numProperties` in class `Properties`

### getValue

    public java.lang.Object getValue(int index)

  Description copied from class: `Properties`
  Returns the value of the property at the given index.

  Specified by:
    `getValue` in class `Properties`

### isReadWrite

    public boolean isReadWrite(int index)

  Description copied from class: `Properties`
  Returns true if the property at the given index is both readable and writable (as opposed to read-only).

  Specified by:
    `isReadWrite` in class `Properties`

### getName

    public java.lang.String getName(int index)

  Description copied from class: `Properties`
  Returns the name of the property at the given index.

  Specified by:
    `getName` in class `Properties`

### getType

    public java.lang.Class getType(int index)

  Description copied from class: `Properties`
  Returns the Class (or for primitive objects, the primitive TYPE) of the property at the given index.

  Specified by:
    `getType` in class `Properties`

### _setValue

    protected java.lang.Object _setValue(int index,
                                         java.lang.Object value)

  Specified by:
    `_setValue` in class `Properties`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD