Module org.refcodes.component
Package org.refcodes.component
Interface ConnectionOpenableHandle<H,CON>
- Type Parameters:
H
- The type of the handle.CON
- The connection used to open the referenced instance.
- All Known Subinterfaces:
ConnectionComponentHandle<H,
,CON> ConnectionComponentHandle.ConnectionAutomatonHandle<H,
,CON> ConnectionOpenableHandle.ConnectionOpenAutomatonHandle<H,
CON>
public interface ConnectionOpenableHandle<H,CON>
The
ConnectionOpenableHandle
interface defines those methods related
to the handle based open/connect life-cycle.
The handle reference requires the ConnectionOpenable
interface to be
implemented.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
TheConnectionOpenableHandle.ConnectionOpenAutomatonHandle
interface defines those methods related to the handle based open/connect life-cycle. -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasConnectionOpenable
(H aHandle) Determines whether the handle reference isConnectionOpenable
by implementing theConnectionOpenable
interface.void
Open/connect the component identified by the given handle.default void
openUnchecked
(H aHandle, CON aConnection) Opens the component by callingopen(Object, Object)
without you to require catching anIOException
.
-
Method Details
-
hasConnectionOpenable
Determines whether the handle reference isConnectionOpenable
by implementing theConnectionOpenable
interface.- Parameters:
aHandle
- The handle to test whether the reference provides the according functionality.- Returns:
- True in case the reference provides the according functionality.
- Throws:
UnknownHandleRuntimeException
- in case the handle is unknown.
-
open
void open(H aHandle, CON aConnection) throws IOException, UnknownHandleRuntimeException, UnsupportedHandleOperationRuntimeException, IllegalHandleStateChangeRuntimeException Open/connect the component identified by the given handle.- Parameters:
aHandle
- The handle identifying the component.aConnection
- The connection to be passed to the implementing instance.- Throws:
IOException
- in case opening/connecting fails.UnknownHandleRuntimeException
- in case the given handle is unknown.UnsupportedHandleOperationRuntimeException
- in case the reference of the handle does not support the requested operation.IllegalHandleStateChangeRuntimeException
- Thrown in case a state change is not possible due to the current state the referenced component is in.
-
openUnchecked
Opens the component by callingopen(Object, Object)
without you to require catching anIOException
.- Parameters:
aHandle
- The handle identifying the component.aConnection
- The connection to be passed to the implementing instance.- Throws:
org.refcodes.exception.IORuntimeException
- encapsulates the cause and is thrown upon encountering aIOException
exception
-