# The MessageField Class - Google App Engine - Google Code

English ▼
Skip to page content Skip to main navigation
e.g. "templates" or "datastore"

# The MessageField Class

#### Experimental!

ProtoRPC is an experimental, innovative, and rapidly changing new feature for App Engine. Unfortunately, being on the bleeding edge means that we may make backwards-incompatible changes to ProtoRPC. We will inform the community when this feature is no longer experimental.

The MessageField class is used to define messages for efficient transmission across network or process space. Messages are defined using field classes.

`MessageField` is provided by the `protorpc.messages` module.

- MessageField()
- Class Property
  - type()

## Constructor

The constructor of the MessageField class is defined as follows:

class MessageField(message_type, number, [required=False | repeated=False], variant=None)

  Defines fields for sub-message values.

  Arguments:

  message_type
    The message type for the field. Must be a subclass of .
  number
    Number of the field. Must be unique per message class.
  required=False
    Whether or not this field is required. Mutually exclusive with the `repeated` argument; do not specify `repeated=True` if you use `required=True`.
  repeated=False
    Whether or not this field is repeated. Mutually exclusive with the `required` argument; do not specify `required=True` if you use `repeated=True`.
  variant
    Wire-format variant hint.

  Raises a FieldDefinitionError if the `message_type` is invalid.

## Class Property

The MessageField class provides the following property:

type()
  The message type used for the field.