Class XstreamPathConverter

java.lang.Object
org.codice.ddf.spatial.ogc.csw.catalog.converter.XstreamPathConverter
All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher

public class XstreamPathConverter extends Object implements com.thoughtworks.xstream.converters.Converter
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    protected boolean
    doBasicPathsMatch(com.thoughtworks.xstream.io.path.Path pathObj1, com.thoughtworks.xstream.io.path.Path pathObj2)
    This method uses a streaming-like approach to compare 2 paths with a single iteration.
    void
    marshal(Object o, com.thoughtworks.xstream.io.HierarchicalStreamWriter hierarchicalStreamWriter, com.thoughtworks.xstream.converters.MarshallingContext marshallingContext)
     
    protected void
    readPath(com.thoughtworks.xstream.io.path.PathTrackingReader reader, com.thoughtworks.xstream.io.path.PathTracker tracker, XstreamPathValueTracker pathValueTracker, boolean endElement)
    Reads through the tree looking for a specific path and returns the value at that node
    unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
     
    protected void
    updatePath(com.thoughtworks.xstream.io.path.PathTrackingReader reader, com.thoughtworks.xstream.io.path.Path path, com.thoughtworks.xstream.io.path.Path currentPath, XstreamPathValueTracker pathValueTracker, boolean endElement)
     

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • XstreamPathConverter

      public XstreamPathConverter()
  • Method Details

    • marshal

      public void marshal(Object o, com.thoughtworks.xstream.io.HierarchicalStreamWriter hierarchicalStreamWriter, com.thoughtworks.xstream.converters.MarshallingContext marshallingContext)
      Specified by:
      marshal in interface com.thoughtworks.xstream.converters.Converter
    • unmarshal

      public Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context) throws com.thoughtworks.xstream.converters.ConversionException
      Specified by:
      unmarshal in interface com.thoughtworks.xstream.converters.Converter
      Parameters:
      reader -
      context -
      Returns:
      XstreamPathValueTracker
      Throws:
      com.thoughtworks.xstream.converters.ConversionException
    • readPath

      protected void readPath(com.thoughtworks.xstream.io.path.PathTrackingReader reader, com.thoughtworks.xstream.io.path.PathTracker tracker, XstreamPathValueTracker pathValueTracker, boolean endElement)
      Reads through the tree looking for a specific path and returns the value at that node

      The reader is moved to the next node in the path

      For example, if readPath(reader, "a", "b", "c") is called, then the value at /a/b/c is returned and the reader is advanced to "" {code} <-- reader starts here value {code}

      Parameters:
      reader -
      tracker -
      pathValueTracker -
    • updatePath

      protected void updatePath(com.thoughtworks.xstream.io.path.PathTrackingReader reader, com.thoughtworks.xstream.io.path.Path path, com.thoughtworks.xstream.io.path.Path currentPath, XstreamPathValueTracker pathValueTracker, boolean endElement)
    • doBasicPathsMatch

      protected boolean doBasicPathsMatch(com.thoughtworks.xstream.io.path.Path pathObj1, com.thoughtworks.xstream.io.path.Path pathObj2)
      This method uses a streaming-like approach to compare 2 paths with a single iteration. The comparison excludes count indexes in the path as well as the value of attributes in determining equivalence. For the purposes of this method, "/a/b/c" matches "/a/b[2]/c/@attr". Also checks that "a/b/c/*" will match "/a/b/c/d".
      Parameters:
      pathObj1 - The first path
      pathObj2 - The second path
      Returns:
      If the paths match
    • canConvert

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