Beispiel #1
0
        class AnotherObject(SomeObject):
            d = jsonobject.JSONProperty(default='D')
            e = jsonobject.ReadonlyJSONProperty(default='E')

            @jsonproperty
            def f(self):
                return 'F'
Beispiel #2
0
        class SomeObject(jsonobject.JSONSerializableObject):
            a = jsonobject.JSONProperty(default='A')
            b = jsonobject.ReadonlyJSONProperty(default='B')

            @jsonproperty
            def c(self):
                return 'C'
Beispiel #3
0
 class SomeObject(jsonobject.JSONSerializableObject):
     a = jsonobject.ReadonlyJSONProperty(value_type=str,
                                         wrapped_variable='_a')
Beispiel #4
0
 class SomeObject(jsonobject.JSONSerializableObject):
     a = jsonobject.ReadonlyJSONProperty(default='A', value_type=str)
Beispiel #5
0
 class SomeObject(jsonobject.JSONSerializableObject):
     foo = jsonobject.ReadonlyJSONProperty()
Beispiel #6
0
 class SomeObject(jsonobject.JSONSerializableObject):
     foo = jsonobject.ReadonlyJSONProperty(wrapped_variable='_foo')
     # This is a class variable whose name conflicts with the wrapped
     # variable of foo.
     _foo = 'CLASS_FOO'
Beispiel #7
0
 class SomeObject(jsonobject.JSONSerializableObject):
     # If wrapped_variable is omitted, the property tries to wrap one
     # with a random unique name.
     foo = jsonobject.ReadonlyJSONProperty()
Beispiel #8
0
        class SomeObject(jsonobject.JSONSerializableObject):
            def __init__(self, foo):
                self._foo = foo

            # This property exports SomeObject._foo in a readonly manner.
            foo = jsonobject.ReadonlyJSONProperty(wrapped_variable='_foo')