Class MvmlParser


  • public class MvmlParser
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      MvmlParser()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String get​(java.lang.String key)
      Get the value of a key
      <T> T get​(java.lang.String key, java.lang.Class<T> type)
      Get the value of a key and convert it to a certain type
      void migrate()
      Migrate the current values to a new file.
      void read()
      Overwrite the memory with information stored on disc
      java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.String>> readAll()
      Get all key and values as pairs (to store and iterate)
      void remove​(java.lang.String key)
      Delete a node by key
      void save()
      Overwrite the file on disc with information stored in memory
      void set​(java.lang.String key, java.lang.Object value)
      Set a value for a key.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MvmlParser

        public MvmlParser()
    • Method Detail

      • get

        public java.lang.String get​(java.lang.String key)
        Get the value of a key
        Parameters:
        key - Key
        Returns:
        value (String)
      • get

        public <T> T get​(java.lang.String key,
                         java.lang.Class<T> type)
        Get the value of a key and convert it to a certain type
        Type Parameters:
        T - object type
        Parameters:
        key - Key
        type - object class
        Returns:
        instance of T
      • remove

        public void remove​(java.lang.String key)
        Delete a node by key
        Parameters:
        key - Key to node
      • readAll

        public java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.String>> readAll()
        Get all key and values as pairs (to store and iterate)
        Returns:
        list of pairs
      • set

        public void set​(java.lang.String key,
                        java.lang.Object value)
        Set a value for a key. If the path is not present, it will create all required Nodes createNodePath(Node, String)
        Parameters:
        key - Key
        value - Value
      • save

        public void save()
        Overwrite the file on disc with information stored in memory
      • read

        public void read()
        Overwrite the memory with information stored on disc
      • migrate

        public void migrate()
                     throws java.io.IOException
        Migrate the current values to a new file. This expects that the file has been replaced after loading. It will attempt to re-read the file and override the values with the old values. New keys will not be overwritten
        Throws:
        java.io.IOException - if something happens while parsing