Class AssumedValue<T>


  • public class AssumedValue<T>
    extends java.lang.Object
    A value that the compiler can assume is constant, but can be changed by invalidation.

    Compiled code that uses the value will be invalidated each time the value changes, so you should take care to only change values infrequently, or to monitor the number of times the value has changed and at some point to replace the value with something more generic so that it does not have to be changed and code does not have to keep being recompiled.

    • Constructor Summary

      Constructors 
      Constructor Description
      AssumedValue​(java.lang.String name, T initialValue)  
      AssumedValue​(T initialValue)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T get()
      Get the current value, updating it if it has been set(T).
      void set​(T newValue)
      Set a new value, which will be picked up the next time get() is called.
      • Methods inherited from class java.lang.Object

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

      • AssumedValue

        public AssumedValue​(T initialValue)
      • AssumedValue

        public AssumedValue​(java.lang.String name,
                            T initialValue)
    • Method Detail

      • get

        public T get()
        Get the current value, updating it if it has been set(T). The compiler may be able to make this method return a constant value, but still accommodate mutation.
      • set

        public void set​(T newValue)
        Set a new value, which will be picked up the next time get() is called.