Package org.jruby
Class RubyClass.MarshalTuple
java.lang.Object
org.jruby.RubyClass.MarshalTuple
- Enclosing class:
- RubyClass
A tuple representing the mechanism by which objects should be marshaled.
This tuple caches the type of marshaling to perform (from @MarshalType),
the method to be used for marshaling data (either marshal_load/dump or
_load/_dump), and the generation of the class at the time this tuple was
created. When "dump" or "load" are invoked, they either call the default
marshaling logic (@MarshalType.DEFAULT) or they further invoke the cached
marshal_dump/load or _dump/_load methods to marshal the data.
It is expected that code outside MarshalTuple will validate that the
generation number still matches before invoking load or dump.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal CacheEntryThe method associated with this tuple.final intThe generation of the associated class at the time of creationstatic final RubyClass.MarshalTupleA "null" tuple, used as the default value for caches.final RubyClass.MarshalTypeThe type of marshaling that will be performed -
Constructor Summary
ConstructorsConstructorDescriptionMarshalTuple(CacheEntry entry, RubyClass.MarshalType type, int generation) Construct a new MarshalTuple with the given values. -
Method Summary
Modifier and TypeMethodDescriptionvoiddump(MarshalStream stream, IRubyObject object) Dump the given object to the given stream, using the appropriate marshaling method.
-
Field Details
-
NULL_TUPLE
A "null" tuple, used as the default value for caches. -
entry
The method associated with this tuple. -
type
The type of marshaling that will be performed -
generation
public final int generationThe generation of the associated class at the time of creation
-
-
Constructor Details
-
MarshalTuple
Construct a new MarshalTuple with the given values.- Parameters:
entry- The method entry to invoke, or null in the case of default marshaling.type- The type of marshaling to perform, from @MarshalTypegeneration- The generation of the associated class at the time of creation.
-
-
Method Details
-
dump
Dump the given object to the given stream, using the appropriate marshaling method.- Parameters:
stream- The stream to which to dumpobject- The object to dump- Throws:
IOException- If there is an IO error during dumping
-