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

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

            @jsonproperty
            def c(self):
                return 'C'
예제 #3
0
 class SomeObject(jsonobject.JSONSerializableObject):
     a = jsonobject.ReadonlyJSONProperty(value_type=str,
                                         wrapped_variable='_a')
예제 #4
0
 class SomeObject(jsonobject.JSONSerializableObject):
     a = jsonobject.ReadonlyJSONProperty(default='A', value_type=str)
예제 #5
0
 class SomeObject(jsonobject.JSONSerializableObject):
     foo = jsonobject.ReadonlyJSONProperty()
예제 #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'
예제 #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()
예제 #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')