public interface PropertiedObject
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);
Modifier and Type | Method and Description |
---|---|
boolean |
clearKeyedProperty(java.lang.String propertyName)
Removes all keys associated with the supplied property.
|
long |
creationDate()
Returns the date/time when the object was created in milliseconds since January 1, 1970 00:00:00 GMT.
|
java.util.List |
getKeyedPropertyKeys(java.lang.String propertyName)
Returns the keys currently defined for the supplied keyed property name.
|
java.lang.Object |
getKeyedPropertyValue(java.lang.String propertyName,
java.lang.String keyName)
Returns the value of the named property and key or
null if no
such property or key exists. |
java.lang.String |
getLabel()
Returns the object's display label.
|
java.lang.String |
getName()
Returns the object's name.
|
PropertyType |
getPropertyType(java.lang.String propertyName)
Returns the
PropertyType for the named property or null
if no such property exists. |
java.lang.Object |
getPropertyValue(java.lang.String propertyName)
Returns the value of the named property or
null if no such property
exists. |
double |
getSavedByVersion()
Return the object's saved by version.
|
StructuredPropertyDefinition |
getStructuredPropertyDefinition(java.lang.String propertyName)
Returns the
StructuredPropertyDefinition for the named property or null
if no such property exists, or the property is not a structure or structure list property. |
boolean |
isKeyedProperty(java.lang.String propertyName)
Returns
true if the supplied property name is a keyed property. |
boolean |
isLocked()
Returns
true if this object is locked. |
boolean |
isProperty(java.lang.String propertyName)
Returns
true if the supplied property name is a valid property. |
boolean |
isServerConnectionRequiredProperty(java.lang.String propertyName)
Returns
true if the supplied property name should only be
set if there is a valid server connection. |
java.util.Iterator |
propertyIterator()
Returns an iterator of property names for this object.
|
void |
setKeyedPropertyValue(java.lang.String propertyName,
java.lang.String keyName,
java.lang.Object value)
Sets the value of the named property and key.
|
void |
setLabel(java.lang.String label)
Sets the object's display label.
|
void |
setPropertyValue(java.lang.String propertyName,
java.lang.Object value)
Sets the value of the named property.
|
void |
setPropertyValues(java.util.Map properties)
Sets the values of the named properties.
|
void |
setPropertyValuesFrom(PropertiedObject otherObject)
Sets the values of the properties that are in both this object
and the supplied other object.
|
void |
unlock()
Removes one level of locking on the object.
|
java.lang.String getName()
double getSavedByVersion() throws java.lang.Exception
java.lang.Exception
- if the information cannot be accessed for some reasonvoid setLabel(java.lang.String label)
"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 .
label
- the object's display labelgetLabel()
,
Property.OBJECT_CUSTOM_NAME
,
Property.OBJECT_USE_CUSTOM_NAME
java.lang.String getLabel()
"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()
.setLabel(String)
,
getName()
,
Property.OBJECT_CUSTOM_NAME
,
Property.OBJECT_USE_CUSTOM_NAME
boolean isProperty(java.lang.String propertyName)
true
if the supplied property name is a valid property.propertyName
- the property nametrue
if the supplied property name is a valid propertyvoid setPropertyValue(java.lang.String propertyName, java.lang.Object value) throws ObjectLockedException, InvalidPropertyException
propertyName
- the property namevalue
- the property valueObjectLockedException
- if the propertied object is lockedInvalidPropertyException
- if the property name is unknown or the
supplied value is not valid for the propertysetPropertyValues(Map)
,
getPropertyValue(String)
void setPropertyValues(java.util.Map properties) throws ObjectLockedException, InvalidPropertyException
properties
- the property/value pairs to be assignedObjectLockedException
- if the propertied object is lockedInvalidPropertyException
- if one of the property names is unknown or
one the supplied values is not valid for that propertysetPropertyValue(String,Object)
,
getPropertyValue(String)
void setPropertyValuesFrom(PropertiedObject otherObject) throws ObjectLockedException
otherObject
- the other object whose properties are to be copiedObjectLockedException
- if the propertied object is lockedsetPropertyValue(String,Object)
,
setPropertyValues(Map)
java.lang.Object getPropertyValue(java.lang.String propertyName) throws InvalidPropertyException
null
if no such property
exists.propertyName
- the property namenull
if no such property
existsInvalidPropertyException
setPropertyValue(String, Object)
,
setPropertyValues(Map)
PropertyType getPropertyType(java.lang.String propertyName)
PropertyType
for the named property or null
if no such property exists.propertyName
- the property namePropertyType
for the named property or null
if no such property existsjava.util.Iterator propertyIterator()
void setKeyedPropertyValue(java.lang.String propertyName, java.lang.String keyName, java.lang.Object value) throws ObjectLockedException, InvalidPropertyException
propertyName
- the property namekeyName
- the key namevalue
- the property valueObjectLockedException
- if the propertied object is lockedInvalidPropertyException
- if the property name is unknown or the
supplied value is not valid for the propertygetKeyedPropertyValue(String, String)
,
clearKeyedProperty(String)
java.lang.Object getKeyedPropertyValue(java.lang.String propertyName, java.lang.String keyName) throws InvalidPropertyException
null
if no
such property or key exists.propertyName
- the property namekeyName
- the key namenull
if no such property
existsInvalidPropertyException
setKeyedPropertyValue(String, String, Object)
,
clearKeyedProperty(String)
boolean clearKeyedProperty(java.lang.String propertyName) throws ObjectLockedException, InvalidPropertyException
propertyName
- the property nametrue
if the property was successfully cleared, or false
if no change was madeObjectLockedException
- if the propertied object is lockedInvalidPropertyException
- if the property name is unknown or the
supplied value is not valid for the propertygetKeyedPropertyValue(String, String)
,
setKeyedPropertyValue(String, String, Object)
boolean isKeyedProperty(java.lang.String propertyName)
true
if the supplied property name is a keyed property.propertyName
- the property nametrue
if the supplied property name is a keyed propertyjava.util.List getKeyedPropertyKeys(java.lang.String propertyName)
propertyName
- the property nameboolean isServerConnectionRequiredProperty(java.lang.String propertyName)
true
if the supplied property name should only be
set if there is a valid server connection.propertyName
- the property nametrue
if the supplied property name should only be
set if there is a valid server connectionStructuredPropertyDefinition getStructuredPropertyDefinition(java.lang.String propertyName)
StructuredPropertyDefinition
for the named property or null
if no such property exists, or the property is not a structure or structure list property.propertyName
- the property nameStructuredPropertyDefinition
for the named property or null
if no such property exists, or the property is not a structure or structure list propertylong creationDate()
boolean isLocked()
true
if this object is locked. An object may have multiple
levels of locking and is only unlocked when all locking contexts have been unwound.
For example, a node may be locked and then the owning stream may also become locked - this
in turn will lock all the nodes within the stream and means that both the stream and
whatever locked the node original node have to unlock it.true
if this object is lockedvoid unlock()
isLocked()
may still return true
.
WARNING do not use this method unless you know exactly what you are
doing. Arbitrarily unlocking an object can have unintended consequences and should only
be used as a last resort.isLocked()
(C) Copyright IBM Corp. 1994, 2015. All Rights Reserved.