Class Attribute.OldValue

java.lang.Object
com.aoapps.lang.attribute.Attribute.OldValue
All Implemented Interfaces:
AutoCloseable
Enclosing class:
Attribute<C,T>

public abstract static class Attribute.OldValue extends Object implements AutoCloseable
A backup value from before attribute initialization, which must be closed to restore the old value. This is best used in try-with-resources.
  • Constructor Details

    • OldValue

      protected OldValue(Object oldValue)
  • Method Details

    • getOldValue

      public Object getOldValue()
      Gets the old value of the attribute, which will be restored on close(). This can be of any type, since this is used to backup arbitrary values before new scopes.
      Returns:
      the old attribute value or null when none
    • close

      public abstract void close()
      Restores the old value of the attribute.
      Specified by:
      close in interface AutoCloseable