Package google :: Package protobuf :: Module message_factory :: Class MessageFactory
[hide private]
[frames] | no frames]

Class MessageFactory

source code

object --+
         |
        MessageFactory
Known Subclasses:

Factory for creating Proto2 messages from descriptors in a pool.

Instance Methods [hide private]
 
GetMessages(self, files)
Gets all the messages from a specified file.
source code
 
GetPrototype(self, descriptor)
Builds a proto2 message class based on the passed in descriptor.
source code
 
__init__(self, pool=None)
Initializes a new factory.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

GetMessages(self, files)

source code 
Gets all the messages from a specified file.

This will find and resolve dependencies, failing if the descriptor
pool cannot satisfy them.

Args:
  files: The file names to extract messages from.

Returns:
  A dictionary mapping proto names to the message classes. This will include
  any dependent messages as well as any messages defined in the same file as
  a specified message.

GetPrototype(self, descriptor)

source code 
Builds a proto2 message class based on the passed in descriptor.

Passing a descriptor with a fully qualified name matching a previous
invocation will cause the same class to be returned.

Args:
  descriptor: The descriptor to build from.

Returns:
  A class describing the passed in descriptor.

__init__(self, pool=None)
(Constructor)

source code 

Initializes a new factory.

Overrides: object.__init__