Class CommentResource


  • public class CommentResource
    extends java.lang.Object
    A simple comment resource emulating basic functionalities of Properties, which, however, interprets IVML qualified names according to its own convention.
    Author:
    Holger Eichelberger
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static char ESCAPE  
      private java.util.Map<java.lang.String,​java.lang.String> mapping  
      private static char SEPARATOR  
    • Constructor Summary

      Constructors 
      Constructor Description
      CommentResource()
      Creates a comment resource.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears this resource.
      boolean containsKey​(java.lang.String key)
      Returns whether a mapping for the given key is known.
      java.lang.String get​(java.lang.String key)
      Returns the resource mapping for the given key.
      boolean isEmpty()
      Returns whether this resource is empty.
      void load​(java.io.Reader reader)
      Loads the resource from a given reader.
      void put​(java.lang.String key, java.lang.String value)
      Adds a new mapping.
      void remove​(java.lang.String key)
      Removes the mapping stored for key.
      void store​(java.io.Writer writer)
      Stores the resource to the given writer.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • mapping

        private java.util.Map<java.lang.String,​java.lang.String> mapping
    • Constructor Detail

      • CommentResource

        public CommentResource()
        Creates a comment resource.
    • Method Detail

      • load

        public void load​(java.io.Reader reader)
                  throws java.io.IOException
        Loads the resource from a given reader. Mappings are added/overwritten, not cleared before.
        Parameters:
        reader - the reader to load the resource from
        Throws:
        java.io.IOException - in case of I/O errors
      • store

        public void store​(java.io.Writer writer)
                   throws java.io.IOException
        Stores the resource to the given writer.
        Parameters:
        writer - the writer to store the resource to
        Throws:
        java.io.IOException - in case of I/O errors
      • clear

        public void clear()
        Clears this resource.
      • isEmpty

        public boolean isEmpty()
        Returns whether this resource is empty.
        Returns:
        true if it is empty, false else
      • get

        public java.lang.String get​(java.lang.String key)
        Returns the resource mapping for the given key.
        Parameters:
        key - the key to return the mapping for
        Returns:
        the mapped value, may be null if no mapping exists
      • put

        public void put​(java.lang.String key,
                        java.lang.String value)
        Adds a new mapping.
        Parameters:
        key - the key for the mapping (must not be null)
        value - the value to be assigned to key
      • remove

        public void remove​(java.lang.String key)
        Removes the mapping stored for key. Nothing will happen if the mapping does not exist.
        Parameters:
        key - the key tor remove the mapping for
      • containsKey

        public boolean containsKey​(java.lang.String key)
        Returns whether a mapping for the given key is known.
        Parameters:
        key - the key to look for
        Returns:
        true if there is a mapping, false else
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object