Package com.luciad.util.enumeration
Class TLcdFinalizedEnumeration
java.lang.Object
com.luciad.util.enumeration.TLcdFinalizedEnumeration
- All Implemented Interfaces:
ILcdAutoCloseableEnumeration,AutoCloseable,Enumeration
This class returns a given
Enumeration, and performs a given action after
having returned the last element.
Example application: when an Enumeration returns data from a file, the
finalizing action can close the file at the end. This way the consumer
of the data does not have to be aware of the data source.
-
Constructor Summary
ConstructorsConstructorDescriptionTLcdFinalizedEnumeration(Enumeration aEnumeration, ILcdFinalizeAction aFinalizeAction) Constructs a newEnumerationthat is identical to the givenEnumeration, but in addition it performs the given action after having returned the last element. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This close method does not throw checked exceptions.booleanImplementsEnumeration.hasMoreElements().ImplementsEnumeration.nextElement().Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Enumeration
asIterator
-
Constructor Details
-
TLcdFinalizedEnumeration
Constructs a newEnumerationthat is identical to the givenEnumeration, but in addition it performs the given action after having returned the last element.- Parameters:
aEnumeration- theEnumerationthat will be returned.aFinalizeAction- the action that is performed at the end.
-
-
Method Details
-
hasMoreElements
public boolean hasMoreElements()ImplementsEnumeration.hasMoreElements().- Specified by:
hasMoreElementsin interfaceEnumeration
-
nextElement
ImplementsEnumeration.nextElement().- Specified by:
nextElementin interfaceEnumeration
-
close
public void close()Description copied from interface:ILcdAutoCloseableEnumerationThis close method does not throw checked exceptions.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceILcdAutoCloseableEnumeration
-