- java.lang.Object
-
- com.aoapps.lang.attribute.Attribute.OldValue
-
- All Implemented Interfaces:
AutoCloseable
public abstract static class Attribute.OldValue extends Object implements AutoCloseable
A backup value from before attribute initialization, which must beclosedto restore the old value. This is best used in try-with-resources.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidclose()Restores the old value of the attribute.ObjectgetOldValue()Gets the old value of the attribute, which will be restored onclose().
-
-
-
Constructor Detail
-
OldValue
protected OldValue(Object oldValue)
-
-
Method Detail
-
getOldValue
public Object getOldValue()
Gets the old value of the attribute, which will be restored onclose(). This can be of any type, since this is used to backup arbitrary values before new scopes.- Returns:
- the old attribute value or
nullwhen none
-
close
public abstract void close()
Restores the old value of the attribute.- Specified by:
closein interfaceAutoCloseable
-
-