Class NilusSettingsWrapper<T>

java.lang.Object
tethys.niluswraps.NilusSettingsWrapper<T>
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
WrappedDescriptionType

public class NilusSettingsWrapper<T> extends Object implements Serializable, Cloneable
Class to wrap up a nilus object so that it can be saved using Java serialization. This is basically saving the xml as a String, since all nilus objects are NOT serializable, but should make it (relatively) straight forward to save nilus objects into PAMGuard settings files.
Author:
dg50
See Also:
  • Field Details

  • Constructor Details

    • NilusSettingsWrapper

      public NilusSettingsWrapper()
  • Method Details

    • getNilusObject

      public T getNilusObject(Class nilusClass)
      Create a nilus object. Have to pass the class type in as an argument, since Class isn't serializable, so can't be stored with the object - which contains nothing but a String, which can be safely serialised.
      Parameters:
      nilusClass -
      Returns:
      nilus object.
    • setNilusObject

      public boolean setNilusObject(T nilusObject)
      Set the nilus object. This marshals the nilus object into xml and saves the data as an intetnal xml string which can be safely serialized.
      Parameters:
      nilusObject - nilus object.
      Returns:
      true if it was marshalled OK.
    • repackNilusObject

      public boolean repackNilusObject()
      Repack the object.i.e. write the xml text string. May want to do this before serializing or cloning.
      Returns:
    • getDocument

      public Document getDocument()
      Get a document from the internal xml String representation.
      Returns:
      xml document
    • getXmlString

      public String getXmlString()
      Returns:
      the xmlString
    • reSerialise

      public void reSerialise()
      Repack the nilus object. Call this just before settings are saved to ensure everything is up to date since this probably won't have happened if changes were made within existing nilus objects and setNilusObject was never called.
    • clone

      public NilusSettingsWrapper<T> clone()