Class ObjectIdConverter

java.lang.Object
hudson.plugins.git.ObjectIdConverter
All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher

public class ObjectIdConverter extends Object implements com.thoughtworks.xstream.converters.Converter
Object id converter. This is required for legacy support for originally serializing an ObjectId as a byte[]. The new format supports marshalling as a standard lower-case SHA1 hexadecimal string but unmarshalling both byte[] and String types.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create ObjectId converter
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    protected boolean
    isLegacyNode(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
    Is the current reader node a legacy node?
    protected Object
    legacyUnmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
    Legacy unmarshalling of object id
    void
    marshal(Object source, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)
     
    unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ObjectIdConverter

      public ObjectIdConverter()
      Create ObjectId converter
  • Method Details

    • canConvert

      public boolean canConvert(Class type)
      Specified by:
      canConvert in interface com.thoughtworks.xstream.converters.ConverterMatcher
    • marshal

      public void marshal(Object source, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)
      Specified by:
      marshal in interface com.thoughtworks.xstream.converters.Converter
    • isLegacyNode

      protected boolean isLegacyNode(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
      Is the current reader node a legacy node?
      Parameters:
      reader - stream reader
      context - usage context of reader
      Returns:
      true if legacy, false otherwise
    • legacyUnmarshal

      protected Object legacyUnmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
      Legacy unmarshalling of object id
      Parameters:
      reader - stream reader
      context - usage context of reader
      Returns:
      object id
    • unmarshal

      public Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
      Specified by:
      unmarshal in interface com.thoughtworks.xstream.converters.Converter