Package org.refcodes.component
Class AbstractConnectableAutomaton
- java.lang.Object
-
- 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 java.lang.Object implements ConnectableComponent.ConnectableAutomaton
TheAbstractConnectableAutomatonimplements the very basicAbstractConnectableAutomatonfunctionality.
-
-
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.ClosedProperty
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectableComponent
ConnectableComponent.ConnectableAutomaton
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor
ConnectionStatusAccessor.ConnectionStatusMutator, ConnectionStatusAccessor.ConnectionStatusProperty
-
Nested classes/interfaces inherited from interface org.refcodes.component.OpenedAccessor
OpenedAccessor.OpenedMutator, OpenedAccessor.OpenedProperty
-
-
Constructor Summary
Constructors Constructor Description AbstractConnectableAutomaton()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the component's connection(s).ConnectionStatusgetConnectionStatus()Retrieves theConnectionStatusproperty from the property.booleanisClosable()Determines whether the component's connection(s) may get closed.booleanisClosed()Retrieves the is-closed status.protected booleanisOpenable()Checks 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 interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUnchecked
-
Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor
isConnectionOpened
-
-
-
-
Method Detail
-
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 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
public void close() throws CloseExceptionCloses the component's connection(s). Throws aCloseExceptionas 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:
CloseException- in case closing or pre-closing (flushing) fails.
-
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
public ConnectionStatus 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:
Openable.OpenAutomaton.isOpenable()
-
open
protected void open() throws OpenExceptionOpen.- Throws:
OpenException- the open exception- See Also:
Openable.open()
-
setConnectionStatus
protected void setConnectionStatus(ConnectionStatus aConnectionStatus)
Sets theConnectionStatusproperty for the property.- Parameters:
aConnectionStatus- TheConnectionStatusproperty to be stored by the property.
-
-