java.lang.Object
org.refcodes.component.AbstractConnectable
org.refcodes.component.AbstractConnectableAutomaton
- All Implemented Interfaces:
Closable,Closable.CloseAutomaton,ClosedAccessor,ConnectableComponent,ConnectableComponent.ConnectableAutomaton,ConnectionStatusAccessor,OpenedAccessor
- Direct Known Subclasses:
AbstractDeviceAutomaton
public abstract class AbstractConnectableAutomaton
extends AbstractConnectable
implements ConnectableComponent.ConnectableAutomaton
The
AbstractConnectableAutomaton implements the very basic
AbstractConnectableAutomaton functionality.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.component.Closable
Closable.CloseAutomaton, Closable.CloseBuilder<B extends Closable.CloseBuilder<B>>Nested classes/interfaces inherited from interface org.refcodes.component.ClosedAccessor
ClosedAccessor.ClosedMutator, ClosedAccessor.ClosedPropertyNested classes/interfaces inherited from interface org.refcodes.component.ConnectableComponent
ConnectableComponent.ConnectableAutomatonNested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor
ConnectionStatusAccessor.ConnectionStatusMutator, ConnectionStatusAccessor.ConnectionStatusPropertyNested classes/interfaces inherited from interface org.refcodes.component.OpenedAccessor
OpenedAccessor.OpenedMutator, OpenedAccessor.OpenedProperty -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the component's connection(s).Retrieves theConnectionStatusproperty from the property.booleanDetermines whether the component's connection(s) may get closed.booleanisClosed()Retrieves the is-closed status.protected booleanChecks if is openable.booleanisOpened()Retrieves the is-opened property from the opened property.protected voidopen()Open.protected voidsetConnectionStatus(ConnectionStatus aConnectionStatus) Sets theConnectionStatusproperty for the property.Methods inherited from class org.refcodes.component.AbstractConnectable
isThrownAsOfAlreadyClosedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUnchecked
-
Constructor Details
-
AbstractConnectableAutomaton
public AbstractConnectableAutomaton()
-
-
Method Details
-
isOpened
public boolean isOpened()Retrieves the is-opened property from the opened property. Determines whether the component's connection is opened. A component's connection is opened after being opened as ofOpenable.open()orConnectionOpenable.open(Object).- Specified by:
isOpenedin interfaceConnectionStatusAccessor- Specified by:
isOpenedin interfaceOpenedAccessor- Returns:
- True in case of being opened (returns the is-opened property stored by the opened property).
-
isClosable
public boolean isClosable()Determines whether the component's connection(s) may get closed.- Specified by:
isClosablein interfaceClosable.CloseAutomaton- Returns:
- True if
Closable.close()is possible.
-
close
Closes the component's connection(s). Throws aIOExceptionas upon close we may have to do things like flushing buffers which can fail (and would otherwise fail unhandled or even worse unnoticed).- Specified by:
closein interfaceClosable- Throws:
IOException- thrown in case closing failed.
-
isClosed
public boolean isClosed()Retrieves the is-closed status. Determines whether the component's connection is closed. A component's connection is closed after being closed as ofClosable.close().- Specified by:
isClosedin interfaceClosedAccessor- Returns:
- True in case of being closed.
-
getConnectionStatus
Retrieves theConnectionStatusproperty from the property. Determines in whichConnectionStatusstatus a component is in.- Specified by:
getConnectionStatusin interfaceConnectionStatusAccessor- Returns:
- Returns the
ConnectionStatusproperty stored by the property.
-
isOpenable
protected boolean isOpenable()Checks if is openable.- Returns:
- true, if is openable
- See Also:
-
open
Open.- Throws:
IOException- the open exception- See Also:
-
setConnectionStatus
Sets theConnectionStatusproperty for the property.- Parameters:
aConnectionStatus- TheConnectionStatusproperty to be stored by the property.
-