class AnotherObject(SomeObject): d = jsonobject.JSONProperty(default='D') e = jsonobject.ReadonlyJSONProperty(default='E') @jsonproperty def f(self): return 'F'
class SomeObject(jsonobject.JSONSerializableObject): a = jsonobject.JSONProperty(default='A') b = jsonobject.ReadonlyJSONProperty(default='B') @jsonproperty def c(self): return 'C'
class SomeObject(jsonobject.JSONSerializableObject): a = jsonobject.ReadonlyJSONProperty(value_type=str, wrapped_variable='_a')
class SomeObject(jsonobject.JSONSerializableObject): a = jsonobject.ReadonlyJSONProperty(default='A', value_type=str)
class SomeObject(jsonobject.JSONSerializableObject): foo = jsonobject.ReadonlyJSONProperty()
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'
class SomeObject(jsonobject.JSONSerializableObject): # If wrapped_variable is omitted, the property tries to wrap one # with a random unique name. foo = jsonobject.ReadonlyJSONProperty()
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')