hpcflow.sdk.core.json_like.ChildObjectSpec#
- class hpcflow.sdk.core.json_like.ChildObjectSpec(name, class_name=None, class_obj=None, json_like_name=None, is_multiple=False, dict_key_attr=None, dict_val_attr=None, parent_ref=None, is_single_attribute=False, is_enum=False, is_dict_values=False, is_dict_values_ensure_list=False, shared_data_name=None, shared_data_primary_key=None)#
Bases:
object
Used to describe what the child structure of an class is so that the generic deserializer can build the structure.
Methods
Attributes
The name of the class (or class of members of a list) used to deserialize the attribute.
The class (or class of members of a list) used to deserialize the attribute.
If set, the name of an attribute of the object to use as a dictionary key.
If set, the name of an attribute of the object to use as a dictionary value.
If true, the child object is a dict, whose values are of the specified class.
If true, values that are not lists are cast to lists and multiple child objects are instantiated for each dict value.
If true, the object is an enum member and should use special serialization rules.
If true, the attribute is really a list of instances, or a dictionary if
dict_key_attr
is set.If true, enables special handling where there can be only one child descriptor for a containing class.
The name of the key used in the JSON document, if different from the attribute name.
If set, the attribute of the child object that contains a reference to its parent.
What key to look values up under in the shared data cache.
What attribute provides the value of the key into the shared data cache.
The name of the attribute.
- Parameters:
name (str) –
class_name (str | None) –
class_obj (type[enum.Enum | hpcflow.sdk.core.json_like.BaseJSONLike] | None) –
json_like_name (str | None) –
is_multiple (bool) –
dict_key_attr (str | None) –
dict_val_attr (str | None) –
parent_ref (str | None) –
is_single_attribute (bool) –
is_enum (bool) –
is_dict_values (bool) –
is_dict_values_ensure_list (bool) –
shared_data_name (str | None) –
shared_data_primary_key (str | None) –
- class_name: str | None = None#
The name of the class (or class of members of a list) used to deserialize the attribute.
- class_obj: type[enum.Enum | hpcflow.sdk.core.json_like.BaseJSONLike] | None = None#
The class (or class of members of a list) used to deserialize the attribute.
- dict_key_attr: str | None = None#
If set, the name of an attribute of the object to use as a dictionary key. Requires that
is_multiple
be set as well.
- dict_val_attr: str | None = None#
If set, the name of an attribute of the object to use as a dictionary value. If not set but
dict_key_attr
is set, the whole object is the value. Requires thatdict_key_attr
be set as well.
- is_dict_values: bool = False#
If true, the child object is a dict, whose values are of the specified class. The dict structure will remain.
- is_dict_values_ensure_list: bool = False#
If true, values that are not lists are cast to lists and multiple child objects are instantiated for each dict value.
- is_enum: bool = False#
If true, the object is an enum member and should use special serialization rules.
- is_multiple: bool = False#
If true, the attribute is really a list of instances, or a dictionary if
dict_key_attr
is set.
- is_single_attribute: bool = False#
If true, enables special handling where there can be only one child descriptor for a containing class.
- json_like_name: str | None = None#
The name of the key used in the JSON document, if different from the attribute name.
- parent_ref: str | None = None#
If set, the attribute of the child object that contains a reference to its parent.
What key to look values up under in the shared data cache. If unspecified, the shared data cache is ignored.
What attribute provides the value of the key into the shared data cache. If unspecified, a hash of the object dictionary is used. Ignored if
shared_data_name
is unspecified.