Class AbstractPlcConnection
java.lang.Object
org.apache.plc4x.java.base.connection.AbstractPlcConnection
- All Implemented Interfaces:
AutoCloseable,PlcConnectionMetadata,PlcConnection
- Direct Known Subclasses:
NettyPlcConnection
public abstract class AbstractPlcConnection extends Object implements PlcConnection, PlcConnectionMetadata
Base class for implementing connections.
Per default, all operations (read, write, subscribe) are unsupported.
Concrete implementations should override the methods indicating connection capabilities
and for obtaining respective request builders.
-
Constructor Summary
Constructors Constructor Description AbstractPlcConnection() -
Method Summary
Modifier and Type Method Description booleancanRead()booleancanSubscribe()booleancanWrite()protected <T extends InternalPlcMessage>
TcheckInternal(Object o, Class<T> clazz)Can be used to check and cast a parameter to its required internal type (can be used for general type checking too).PlcConnectionMetadatagetMetadata()CompletableFuture<Void>ping()PlcReadRequest.BuilderreadRequestBuilder()PlcSubscriptionRequest.BuildersubscriptionRequestBuilder()PlcUnsubscriptionRequest.BuilderunsubscriptionRequestBuilder()PlcWriteRequest.BuilderwriteRequestBuilder()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.plc4x.java.api.PlcConnection
close, connect, isConnected, prepareField
-
Constructor Details
-
AbstractPlcConnection
public AbstractPlcConnection()
-
-
Method Details
-
getMetadata
- Specified by:
getMetadatain interfacePlcConnection
-
ping
- Specified by:
pingin interfacePlcConnection
-
canRead
public boolean canRead()- Specified by:
canReadin interfacePlcConnectionMetadata
-
canWrite
public boolean canWrite()- Specified by:
canWritein interfacePlcConnectionMetadata
-
canSubscribe
public boolean canSubscribe()- Specified by:
canSubscribein interfacePlcConnectionMetadata
-
readRequestBuilder
- Specified by:
readRequestBuilderin interfacePlcConnection
-
writeRequestBuilder
- Specified by:
writeRequestBuilderin interfacePlcConnection
-
subscriptionRequestBuilder
- Specified by:
subscriptionRequestBuilderin interfacePlcConnection
-
unsubscriptionRequestBuilder
- Specified by:
unsubscriptionRequestBuilderin interfacePlcConnection
-
checkInternal
Can be used to check and cast a parameter to its required internal type (can be used for general type checking too).- Type Parameters:
T- the type of the expectedclazz.- Parameters:
o- the object to be checked against targetclazz.clazz- the expectedclazz.- Returns:
- the cast type of
clazz.
-