Package org.jruby

Class RubyClass.MarshalTuple

java.lang.Object
org.jruby.RubyClass.MarshalTuple
Enclosing class:
RubyClass

private static class RubyClass.MarshalTuple extends Object
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 Details

    • NULL_TUPLE

      public static final RubyClass.MarshalTuple NULL_TUPLE
      A "null" tuple, used as the default value for caches.
    • entry

      public final CacheEntry entry
      The method associated with this tuple.
    • type

      public final RubyClass.MarshalType type
      The type of marshaling that will be performed
    • generation

      public final int generation
      The generation of the associated class at the time of creation
  • Constructor Details

    • MarshalTuple

      public MarshalTuple(CacheEntry entry, RubyClass.MarshalType type, int generation)
      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 @MarshalType
      generation - The generation of the associated class at the time of creation.
  • Method Details

    • dump

      public void dump(MarshalStream stream, IRubyObject object) throws IOException
      Dump the given object to the given stream, using the appropriate marshaling method.
      Parameters:
      stream - The stream to which to dump
      object - The object to dump
      Throws:
      IOException - If there is an IO error during dumping