Package pyxb :: Package utils :: Module utility :: Class PrivateTransient_mixin |
[hide private]
[frames] | no frames]

# type PrivateTransient_mixin

source code

    object --+
             |
       cscRoot --+
                 |
                PrivateTransient_mixin

Known Subclasses:
  - namespace._ComponentDependency_mixin
  - , xmlschema.structures._SchemaComponent_mixin
  - , xmlschema.structures._NamedComponent_mixin
  - , namespace.archive.ModuleRecord
  - , namespace.archive._ObjectOrigin
  - , binding.facets._PatternElement

Emulate the transient keyword from Java for private member variables.

This class defines a `__getstate__` method which returns a copy of `self.__dict__` with certain members removed. Specifically, if a string "s" appears in a class member variable named `__PrivateTransient` defined in the "Class" class, then the corresponding private variable "_Class__s" will be removed from the state dictionary. This is used to eliminate unnecessary fields from instances placed in namespace archives without having to implement a `__getstate__` method in every class in the instance hierarchy.

For an example, see pyxb.xmlschema.structures._SchemaComponent_mixin

If you use this, it is your responsibility to define the `__PrivateTransient` class variable and add to it the required variable names.

Classes that inherit from this are free to define their own `__getstate__` method, which may or may not invoke the superclass one. If you do this, be sure that the class defining `__getstate__` lists PrivateTransient_mixin as one of its direct superclasses, lest the latter end up earlier in the mro and consequently bypass the local override.

Instance Methods | [hide private]
__getstate__(self) | source code
Inherited from `cscRoot`: `__init__`

Class Variables | [hide private]
| __Attribute = ``'``__PrivateTransient``'``