Package dk.gtz.graphedit.serialization
Interface IModelSerializer
- All Known Implementing Classes:
JacksonModelSerializer
public interface IModelSerializer
Interface for model serializer implementations
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addClassLoader
(ClassLoader loader) Add another classloader to the serializer.Desertialize a model editor settings object from a filedeserializeEditorSettings
(String serializedContent) Desertialize a model editor settings object from a string valuedeserializeProject
(File file) Desertialize a model project object from a filedeserializeProject
(String serializedContent) Desertialize a model project object from a string valueDesertialize a model project resource object from a filedeserializeProjectResource
(String serializedContent) Desertialize a model project resource object from a string valueGet the preferred file extension for this serializer.Get a list of supported content types.Serialize a model edge to a string valueserialize
(ModelEditorSettings model) Serialize a model editor settings object to a string valueserialize
(ModelProject model) Serialize a model project object to a string valueserialize
(ModelProjectResource model) Serialize a model project resource object to a string valueserialize
(ModelVertex vertex) Serialize a model vertex to a string value
-
Method Details
-
serialize
Serialize a model vertex to a string value- Parameters:
vertex
- The model vertex to serialize- Returns:
- A serialized string representing the provided vertex
- Throws:
SerializationException
- if something went wrong during serialization
-
serialize
Serialize a model edge to a string value- Parameters:
edge
- The model edge to serialize- Returns:
- A serialized string representing the provided edge
- Throws:
SerializationException
- if something went wrong during serialization
-
serialize
Serialize a model project object to a string value- Parameters:
model
- The model project to serialize- Returns:
- A serialized string representing the provided model
- Throws:
SerializationException
- if something went wrong during serialization
-
serialize
Serialize a model project resource object to a string value- Parameters:
model
- The model project resource to serialize- Returns:
- A serialized string representing the provided model
- Throws:
SerializationException
- if something went wrong during serialization
-
serialize
Serialize a model editor settings object to a string value- Parameters:
model
- The model editor settings to serialize- Returns:
- A serialized string representing the provided model
- Throws:
SerializationException
- if something went wrong during serialization
-
deserializeProjectResource
ModelProjectResource deserializeProjectResource(String serializedContent) throws SerializationException Desertialize a model project resource object from a string value- Parameters:
serializedContent
- A string of content to deserialize- Returns:
- A new
ModelProjectResource
instance based on the serialized content - Throws:
SerializationException
- if something went wrong during deserialization
-
deserializeProjectResource
ModelProjectResource deserializeProjectResource(File file) throws SerializationException, IOException Desertialize a model project resource object from a file- Parameters:
file
- A file handle containing serialized content- Returns:
- A new
ModelProjectResource
instance based on the serialized content of the provided file - Throws:
SerializationException
- if something went wrong during deserializationIOException
- if reading the file failed
-
deserializeProject
Desertialize a model project object from a string value- Parameters:
serializedContent
- A string of content to deserialize- Returns:
- A new
ModelProject
instance based on the serialized content - Throws:
SerializationException
- if something went wrong during deserialization
-
deserializeProject
Desertialize a model project object from a file- Parameters:
file
- A file handle containing serialized content- Returns:
- A new
ModelProject
instance based on the serialized content of the provided file - Throws:
SerializationException
- if something went wrong during deserializationIOException
- if reading the file failed
-
deserializeEditorSettings
ModelEditorSettings deserializeEditorSettings(String serializedContent) throws SerializationException Desertialize a model editor settings object from a string value- Parameters:
serializedContent
- A string of content to deserialize- Returns:
- A new
ModelEditorSettings
instance based on the serialized content - Throws:
SerializationException
- if something went wrong during deserialization
-
deserializeEditorSettings
Desertialize a model editor settings object from a file- Parameters:
file
- A file handle containing serialized content- Returns:
- A new
ModelEditorSettings
instance based on the serialized content of the provided file - Throws:
SerializationException
- if something went wrong during deserializationIOException
- if reading the file failed
-
getSupportedContentTypes
Get a list of supported content types. These are typically in the MIME content format- Returns:
- A list of types that this serializer supports
-
addClassLoader
Add another classloader to the serializer. This is useful when creating plugins with non-core model objects- Parameters:
loader
- The additional loader to use when resolving classes
-
getPreferedFileExtension
String getPreferedFileExtension()Get the preferred file extension for this serializer. e.g. ".json"- Returns:
- A string representing the preferred file extension
-