java.lang.Object
com.github.rvesse.airline.io.ControlTracker<T>
- Type Parameters:
T
- Attribute source type
- Direct Known Subclasses:
OutputStreamControlTracker
,WriterControlTracker
Class used to track the state of a control allowing it to be lazily written
to the output only if necessary and ensuring it can be appropriately reset
when necessary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate T
private T
protected final ControlCodeSource
<T> private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
apply()
Applies the control, if the current state of the control has not been previously applied to the stream then it will be applied nowprotected abstract void
applyInternal
(T value) Method that derived classes must implement to add the actual logic for applying the control to the streamfinal void
reset()
Resets the control to the default unintialized state, if necessary this will will cause theprotected abstract void
resetInternal
(T value) Method that derived classes must implement to add the actual logic for resetting the control against the streamfinal void
Sets the value for the control
-
Field Details
-
provider
-
current
-
previous
-
requireWrite
private boolean requireWrite
-
-
Constructor Details
-
ControlTracker
-
-
Method Details
-
set
Sets the value for the control- Parameters:
value
- Value
-
reset
Resets the control to the default unintialized state, if necessary this will will cause the- Throws:
IOException
-
resetInternal
Method that derived classes must implement to add the actual logic for resetting the control against the stream- Parameters:
value
- Value to be reset from- Throws:
IOException
-
apply
Applies the control, if the current state of the control has not been previously applied to the stream then it will be applied now- Throws:
IOException
-
applyInternal
Method that derived classes must implement to add the actual logic for applying the control to the stream- Parameters:
value
- Value to be applied- Throws:
IOException
-