Class Deferred<T>


  • public class Deferred<T>
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Deferred​(java.lang.String extension, T defaultVal, Parser<T> parser)
      Provide a value of type either as an explicitly assigned default or by reading it, on demand, from a file with a given extension.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T get​(java.nio.file.Path dir)
      Provide the desired value.
      void set​(T value)
      Set the value (overrides any values in files).
      • Methods inherited from class java.lang.Object

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

      • Deferred

        public Deferred​(java.lang.String extension,
                        T defaultVal,
                        Parser<T> parser)
        Provide a value of type either as an explicitly assigned default or by reading it, on demand, from a file with a given extension.
        Parameters:
        extension - the extension of the file to look for, not including the '.'. The first such file found in the directory will be used.
        defaultVal - the value to supply if no such file exists.
        parser - An object capable of reading the desired value from a String.
    • Method Detail

      • get

        public T get​(java.nio.file.Path dir)
        Provide the desired value.
        Parameters:
        dir - directory from which to seek and, if possible, read a value
        Returns:
        the value
      • set

        public void set​(T value)
        Set the value (overrides any values in files).
        Parameters:
        value - value to set