Class PersistenceUtil


  • public final class PersistenceUtil
    extends Object
    evgeny, 3/6/13
    • Method Detail

      • loadModel

        @Nullable
        public static SModel loadModel​(@NotNull
                                       String content)
        Try to load a model using a default ModelFactory identified by extension from supplied textual content.
        Returns:
        null if fails to load model from the content supplied (either model read error, no model factory for the extension, or factory doesn't support textual content)
      • loadModel

        @Nullable
        public static SModel loadModel​(byte[] content,
                                       @NotNull
                                       ModelFactory factory)
        Try to load a model using ModelFactory from supplied content.
        Returns:
        null if fails to load model from the content supplied (either model read error) or loaded model from the byte array content using the supplied model factory
      • loadBinaryModel

        @Nullable
        public static SModel loadBinaryModel​(byte[] content)
      • saveModelToXml

        public static org.jdom.Element saveModelToXml​(SModel model)
      • loadModelFromXml

        public static SModel loadModelFromXml​(org.jdom.Element element)
      • saveBinaryModel

        public static byte[] saveBinaryModel​(SModel model)
      • modelContentAsStream

        public static InputStream modelContentAsStream​(SModel model,
                                                       String extension)
        Serialize model with a persistence identified by extension and provide access to serialized content through InputStream.
        Returns:
        empty stream in case serialization failed. Caller is responsible to close the stream.
      • savePerRootModel

        public static String savePerRootModel​(SModel model,
                                              String name)
      • savePerRootModel

        public static String savePerRootModel​(SModel model,
                                              boolean isHeader)