google.appengine.api.yaml_builder.Builder

Interface for building documents and type from YAML events.

Inherits From: expected_type

Implement this interface to create a new builder. Builders are passed to the BuilderHandler and used as a factory and assembler for creating concrete representations of YAML files.

Methods

AppendTo

View source

Append value to a sequence representation.

Implementation is defined by sub-class of Builder.

Args
subject Object that represents sequence. Value returned from BuildSequence
value Value to be appended to a subject. Can be any kind of value.

BuildDocument

View source

Builds a new document.

The object built by this method becomes the top level entity that the builder handler constructs. The actual type is determined by the sub-class of the Builder class and can essentially be any type at all. This method is always called when the parser encounters the start of a new document.

Returns
New object instance representing concrete document which is returned to user via BuilderHandler.GetResults().

BuildMapping

View source

Builds a new mapping representation.

Called when the StartMapping event is received. The type of object is determined by the Builder sub-class.

Args
top_value Object that will be the new mapping parent. This object is returned from previous call to BuildMapping or BuildSequence.

Returns
Instance of the new object that represents a mapping type in target model.

BuildSequence

View source

Builds a new sequence representation.

Called when the StartSequence event is received. The type of object is determined by the Builder sub-class.

Args
top_value The object that will be the new sequences parent. The object will be returned from previous call to BuildMapping or BuildSequence.

Returns
Instance of new object that represents a sequence type in target model.

EndMapping

View source

Previously constructed mapping scope is at an end.

Called when the end of a mapping block is encountered. This is useful for additional clean up or end-of-scope validation.

Args
top_value Value which is the parent of the mapping.
mapping Mapping which is at the end of its scope.

EndSequence

View source

Previously constructed sequence scope is at an end.

Called when the end of a sequence block is encountered. Useful for additional clean up or end of scope validation.

Args
top_value Value which is the parent of the sequence.
sequence Sequence which is at the end of its scope.

InitializeDocument

View source

Initializes document with a value from the top level of a YAML document.

This method is called when the root document element is encountered at the top level of a YAML document. It should get called immediately after BuildDocument.

Receiving the None value indicates the empty document.

Args
document Document as constructed in BuildDocument.
value Scalar value to initialize the document with.

MapTo

View source

Maps value to a mapping representation.

Implementation is defined by the sub-class of Builder.

Args
subject Object that represents mapping. Value returned from BuildMapping.
key Key used to map value to subject. Can be any scalar value.
value Value which is mapped to subject. Can be any kind of value.