Surgeon

The Surgeon is a Data-E component which is the high-level serialization-and-unserialization tool. It provides a convenient interface to configuring serialization and unserialization in matching ways.

Maker protocol
Returns a const Surgeon using the deSrcKit, and the specified textual prefix, for its depictions.

Use all the defaults of.

General constructor for surgeons.


 * uncallers
 * Defaults to deSubgraphKit.getDefaultUncallers. The search path used to find a portrayal for traversing each node of the subgraph.


 * unscope
 * Defaults to deSubgraphKit.getDefaultUnscope. Cuts off outgoing references, replacing them with named exit points to be reconnected.


 * depictionBuilderMaker
 * Defaults to deBytecodeKit. Used to make the builder which will make the depiction.


 * optPrefix
 * Defaults to null. If non-null, then the optDepictionBuilderMaker and optDepictionRecognizer must be for depictions which are strings. If provided, then it is prepended to the depiction to create the serialized form, and is stripped from the beginning of the depiction prior to serialization.


 * depictionRecognizer
 * Defaults to deBytecodeKit. Used to recognize the depiction built according to optDepictionBuilderMaker.


 * scope
 * Defaults to deSubgraphKit.getDefaultScope. Used to reconnect the named exit points.


 * caller
 * Defaults to . Used to perform a Data-E call expression during unserialization.

Protocol
Returns a surgeon whose configuration is a snapshot of this one and cannot be changed.

Returns a surgeon whose configuration is a copy of this one and can be changed.

Returns a surgeon whose configuration follows this one but cannot be used to change it.

Serializes the subgraph with the provided root, using the configured depiction builder and adding the specified prefix.

Unserializes the provided depiction, using the configured depiction recognizer and stripping off the specified prefix.

Not available in ConstSurgeons.

Adds the provided value as a graph exit:
 * The subgraph recognizer's env now maps value to exitName.
 * The subgraph builder's unenv now maps exitName to value.

As, but if mustBeSettled , additionally requires that value is settled.

The provided uncaller will be consulted by the subgraph recognizer before all previously added uncallers.

The provided uncaller will be consulted by the subgraph recognizer after all previously added uncallers.

As, but mustBeSettled defaults to false.

Adds loader as an exit (as in ) and an uncaller (as in ).

Names which either aren't found, map to null, or aren't settled aren't added.

Unedited javadoc:

The defaultScope / defaultUnscope already has bindings for "null", "false", "true", "NaN", "Infinity", "__makeList", "__identityFunc", "__makeInt", and "import__uriGetter", so addFromSafeScope assumes these are already present and does not add them. Similarly, the defaultUncallers already has the import__uriGetter, so this is not added as a loader.

For different reasons, the opaque__uriGetter is not added by addFromSafeScope -- we leave its addition as a separate policy decision, especially since it needs to be added to the end, not the beginning, of the uncallers list.

Starts by doing an addFromSafeScope

Returns the optPrefix with which this surgeon was constructed.