예제 #1
0
    def func(class_obj):
        if class_obj._descriptor:
            class_obj._descriptor.name = name if name else class_obj.__name__
        else:
            class_obj._descriptor = _MessageDescriptor(name if name else class_obj.__name__)
            Serializer.register_message_descriptor(class_obj, class_obj._descriptor)

        return class_obj
예제 #2
0
    def func(class_obj):
        if class_obj._descriptor is None:
            class_obj._descriptor = _MessageDescriptor()
            Serializer.register_message_descriptor(class_obj, class_obj._descriptor)

        field = _FieldDescriptor(
            name,
            field_type=field_type,
            list_item_type=list_item_type,
            list_item_class=list_item_class,
            object_class=object_class,
            enum_class=enum_class,
        )
        class_obj._descriptor.fields.append(field)
        return class_obj