PropertiedObject Objects
- Simple properties: these are basic name/value pairs
- Keyed properties: these are properties associated with specific objects
An example of a simple property is a Boolean value that specifies to a data file reader whether column names are included in the first line of a file:
myDataReader.setPropertyValue("read_field_names", Boolean.TRUE);
An example of a keyed property is used in an object that allows fields or columns to be removed from the data model. Here the setting is made up of both the property name and the key which is the column name:
// Remove "DateOfBirth" column
myColumnFilter.setKeyedPropertyValue("include", "DateOfBirth", Boolean.FALSE);
Finally note that properties which correspond with Enum values must be converted to strings by calling getName() before being passed to one of the setter methods:
typeProcessor.setKeyedPropertyValue("role", "Drug", ModelingRole.OUT.getName());
Similarly, the getter methods will return Strings which can then be converted to the appropriate Enum value:
String value = (String) typeProcessor.getKeyedPropertyValue("role", "Drug");
ModelingRole role = ModelingRole.getValue(value);
p.getKeyedPropertyKeys(propertyName) : List
propertyName (string) : the property name
Returns the keys currently defined for the supplied keyed property name.
p.getKeyedPropertyValue(propertyName, keyName) : Object
propertyName (string) : the property name
keyName (string) : the key name
Returns the value of the named property and key or None if no such property or key exists.
p.getLabel() : string
Returns the object's display label. The label is the value of the property "custom_name" if that is a non-empty string and the "use_custom_name" property is not set; otherwise, it is the value of getName().
p.getName() : string
Returns the object's name.
p.getPropertyValue(propertyName) : Object
propertyName (string) : the property name
Returns the value of the named property or None if no such property exists.
p.getSavedByVersion() : double
Return the object's saved by version.
Exceptions:
Exception : if the information cannot be accessed for some reason
p.isKeyedProperty(propertyName) : boolean
propertyName (string) : the property name
Returns True if the supplied property name is a keyed property.
p.isServerConnectionRequiredProperty(propertyName) : boolean
propertyName (string) : the property name
Returns True if the supplied property name should only be set if there is a valid server connection.
p.propertyIterator() : Iterator
Returns an iterator of property names for this object.
p.setKeyedPropertyValue(propertyName, keyName, value)
propertyName (string) : the property name
keyName (string) : the key name
value (Object) : the property value
Sets the value of the named property and key.
Exceptions:
ObjectLockedException : if the propertied object is locked
InvalidPropertyException : if the property name is unknown or the supplied value is not valid for the property
p.setLabel(label)
label (string) : the object's display label
Sets the object's display label. If the new label is a non-empty string it is assigned to the property "custom_name", and False is assigned to the property "use_custom_name" so that the specified label takes precedence; otherwise, an empty string is assigned to the property "custom_name", and True is assigned to the property .
p.setPropertyValue(propertyName, value)
propertyName (string) : the property name
value (Object) : the property value
Sets the value of the named property.
Exceptions:
ObjectLockedException : if the propertied object is locked
InvalidPropertyException : if the property name is unknown or the supplied value is not valid for the property
p.setPropertyValues(properties)
properties (Map) : the property/value pairs to be assigned
Sets the values of the named properties. Each entry in the Map consists of a key representing the property name and the value which should be assigned to that property.
Exceptions:
ObjectLockedException : if the propertied object is locked
InvalidPropertyException : if one of the property names is unknown or one the supplied values is not valid for that property
p.setPropertyValuesFrom(otherObject)
otherObject (PropertiedObject) : the other object whose properties are to be copied
Sets the values of the properties that are in both this object and the supplied other object.
Exceptions:
ObjectLockedException : if the propertied object is locked