Class CollectionProperties
- All Implemented Interfaces:
Serializable
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:
-
Field Summary
Fields inherited from class sim.util.Properties
object -
Constructor Summary
ConstructorsConstructorDescriptionObject can be a Collection, a List, a Map, an Indexed, or an array. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectgetName(int index) Returns the name of the property at the given index.getType(int index) Returns the Class (or for primitive objects, the primitive TYPE) of the property at the given index.getValue(int index) Returns the value of the property at the given index.booleanisReadWrite(int index) Returns true if the property at the given index is both readable and writable (as opposed to read-only).booleanReturns true if the number or order of properties could change at any timeintReturns the number of properties discovered in the object.Methods inherited from class sim.util.Properties
betterToString, getDescription, getDomain, getObject, getProperties, getProperties, getProperties, getProperties, getTypeConversion, indexForName, isComposite, isHidden, setValue, setValue, typeToName
-
Constructor Details
-
CollectionProperties
Object can be a Collection, a List, a Map, an Indexed, or an array.
-
-
Method Details
-
isVolatile
public boolean isVolatile()Description copied from class:PropertiesReturns true if the number or order of properties could change at any time- Specified by:
isVolatilein classProperties
-
numProperties
public int numProperties()Description copied from class:PropertiesReturns the number of properties discovered in the object.- Specified by:
numPropertiesin classProperties
-
getValue
Description copied from class:PropertiesReturns the value of the property at the given index.- Specified by:
getValuein classProperties
-
isReadWrite
public boolean isReadWrite(int index) Description copied from class:PropertiesReturns true if the property at the given index is both readable and writable (as opposed to read-only).- Specified by:
isReadWritein classProperties
-
getName
Description copied from class:PropertiesReturns the name of the property at the given index.- Specified by:
getNamein classProperties
-
getType
Description copied from class:PropertiesReturns the Class (or for primitive objects, the primitive TYPE) of the property at the given index.- Specified by:
getTypein classProperties
-
_setValue
- Specified by:
_setValuein classProperties
-