Package tethys.niluswraps
Class NilusSettingsWrapper<T>
java.lang.Object
tethys.niluswraps.NilusSettingsWrapper<T>
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
WrappedDescriptionType
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Get a document from the internal xml String representation.getNilusObject
(Class nilusClass) Create a nilus object.boolean
Repack the object.i.e.void
Repack the nilus object.boolean
setNilusObject
(T nilusObject) Set the nilus object.
-
Field Details
-
serialVersionUID
public static final long serialVersionUID- See Also:
-
-
Constructor Details
-
NilusSettingsWrapper
public NilusSettingsWrapper()
-
-
Method Details
-
getNilusObject
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
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
Get a document from the internal xml String representation.- Returns:
- xml document
-
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
-