Klasse AbstractXmlStream<T>

java.lang.Object
io.jenkins.plugins.util.AbstractXmlStream<T>
Typparameter:
T - type of the entities

public abstract class AbstractXmlStream<T> extends Object
Base class that provides the basic setup to read and write entities of a given type using XStream.
Autor:
Ullrich Hafner
  • Konstruktordetails

    • AbstractXmlStream

      protected AbstractXmlStream(Class<T> type)
      Creates a new instance of AbstractXmlStream.
      Parameter:
      type - the type of the elements that are stored and retrieved
  • Methodendetails

    • createDefaultValue

      protected abstract T createDefaultValue()
      Returns the default value that should be returned if the XML file is broken.
      Gibt zurück:
      the default value
    • configureXStream

      protected void configureXStream(XStream2 xStream)
      Configures the XStream instance with custom converters or alias definitions. This default implementation is empty.
      Parameter:
      xStream - the XStream instance
    • read

      public T read(Path file)
      Reads the specified file and creates a new instance of the given type.
      Parameter:
      file - path to the file
      Gibt zurück:
      the created instance
    • write

      public void write(Path file, T entity)
      Writes the specified instance to the given file.
      Parameter:
      file - path to the file
      entity - the entity to write to the file