OEFieldMeta

class OEFieldMeta

The OEFieldMeta class is used to associate metadata with data to be stored on OERecord objects. Two types of metadata can be assigned to an OEFieldMeta object: options are simple flags, while attributes are key-value pairs. Constants defining both options and attributes are defined in the OEMetadata namespace.

Constructors

OEFieldMeta()

The default constructor initializes an empty metadata object.

OEFieldMeta(rhs: OEFieldMeta)

Copy constructor.

set_option

set_option(option: int) -> OEFieldMeta

Adds the specified option to the OEFieldMeta object. Options are specified in the OEMetadata namespace.

set_options

set_options(options: List[int]) -> OEFieldMeta

Sets all the option values for the OEFieldMeta object at once. Options are specified in the OEMetadata namespace.

get_options

get_options() -> List[int]

Returns all the option values for the OEFieldMeta object at once. Options are specified in the OEMetadata namespace.

has_option

has_option(option: int) -> bool

Returns True if this OEFieldMeta object contains the specified option.

add_relation

add_relation(relationship: int, otherField: OEFieldBase) -> OEFieldMeta

Specifies a relationship to another field on the same record. For example, this could be used to specify that one field contains error bars for another field. The relationships are specified in the Relations section of the OEMetadata namespace.

get_field_relations

get_field_relations(fieldName: str) -> List[int]

Returns the relationships that this OEFieldMeta object has to the named field. The relationships are specified in the Relations section of the OEMetadata namespace.

clear

clear() -> None

Clears all attributes and options from the OEFieldMeta object.

set_attribute

set_attribute(key: int, value: str) -> OEFieldMeta
set_attribute(key: int, value: int) -> OEFieldMeta
set_attribute(key: int, value: float) -> OEFieldMeta

Sets a metadata key-value pair on the OEFieldMeta object. Any attribute(s) with the same key are replaced. The key values are from the OEMetadata namespace.

add_attribute

add_attribute(key: int, value: str) -> OEFieldMeta
add_attribute(key: int, value: int) -> OEFieldMeta
add_attribute(key: int, value: float) -> OEFieldMeta

Sets a metadata key-value pair on the OEFieldMeta object. Multiple attributes for the same key are allowed, and this method adds additional values for the specified key. The key values are from the OEMetadata namespace.

get_attribute

get_attribute(key: int, idx: int=0) -> Union[str, int, float, None]

Returns the attribute value for the provided key and index. If the OEFieldMeta object doesn’t have a corresponding value, a None is returned. Because an attribute key can have multiple values, the idx argument specifies which value to return. The key values are from the OEMetadata namespace.

has_attribute

has_attribute(key: int) -> bool
has_attribute(key: int, value: str) -> bool
has_attribute(key: int, value: int) -> bool
has_attribute(key: int, value: float) -> bool

Returns True if this OEFieldMeta object contains the specified attribute. If the value argument is specified, the method will return true if that specific key-value pair is present. Otherwise, it will return true if any value is present for the provided key.

remove_attribute

remove_attribute(unsigned int key) -> OEFieldMeta
remove_attribute(unsigned int key, value: str) -> OEFieldMeta
remove_attribute(unsigned int key, value: int) -> OEFieldMeta
remove_attribute(unsigned int key, value: float) -> OEFieldMeta

Removes a metadata key-value pair from the OEFieldMeta object. If the value is specified, that specific key-value pair is removed from the OEFieldMeta object. Otherwise, all values with the provided key are removed.

get_name

get_name(optionOrAttributeKey: int) -> str

Returns a name for the specified option or attribute key.

get_value

get_value(name: str) -> int

Returns an integer value for the specified option name. The returned values are from the OEMetadata namespace.

is_option

IsOption(key: int) -> bool

Returns True if the provided metadata key is an option, rather than an attribute. The key value is from the OEMetadata namespace.