Class NTPublishAnnotatedOperation<D,P extends Publishable>
- java.lang.Object
-
- edu.wpi.grip.core.operations.network.NetworkPublishOperation<D>
-
- edu.wpi.grip.core.operations.network.PublishAnnotatedOperation<D,P>
-
- edu.wpi.grip.core.operations.network.networktables.NTPublishAnnotatedOperation<D,P>
-
- Type Parameters:
D
- the type of the data to publish (e.g.Number
)P
- the publishable analog of the data (e.g..network.NumberPublishable NumberPublishable
)
- All Implemented Interfaces:
Operation
public class NTPublishAnnotatedOperation<D,P extends Publishable> extends PublishAnnotatedOperation<D,P>
An operation that publishes any type that implementsPublishable
to NetworkTables. To be publishable, a type should have one or more accessor methods annotated withPublishValue
. This is done with annotations instead of methods
-
-
Field Summary
-
Fields inherited from class edu.wpi.grip.core.operations.network.NetworkPublishOperation
dataSocket, dataType, nameSocket
-
-
Constructor Summary
Constructors Constructor Description NTPublishAnnotatedOperation(InputSocket.Factory inputSocketFactory, java.lang.Class<D> dataType, java.lang.Class<P> publishType, java.util.function.Function<D,P> converter, MapNetworkPublisherFactory publisherFactory)
Creates an NTPublishAnnotatedOperation.NTPublishAnnotatedOperation(InputSocket.Factory inputSocketFactory, java.lang.Class<P> dataType, MapNetworkPublisherFactory publisherFactory)
Creates an NTPublishAnnotatedOperation for a type that already implementsPublishable
(e.g.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OperationDescription
descriptionFor(java.lang.Class<?> dataType)
Creates anOperationDescription
for anNTPublishAnnotatedOperation
that publishes data of the given type.-
Methods inherited from class edu.wpi.grip.core.operations.network.PublishAnnotatedOperation
cleanUp, createFlagSockets, doPublish, get, getSocketType, valueMethodStream
-
Methods inherited from class edu.wpi.grip.core.operations.network.NetworkPublishOperation
getInputSockets, getOutputSockets, perform
-
-
-
-
Constructor Detail
-
NTPublishAnnotatedOperation
public NTPublishAnnotatedOperation(InputSocket.Factory inputSocketFactory, java.lang.Class<P> dataType, MapNetworkPublisherFactory publisherFactory)
Creates an NTPublishAnnotatedOperation for a type that already implementsPublishable
(e.g.ContoursReport
).- Parameters:
inputSocketFactory
- factory for creating the input socketsdataType
- the type of the data to publishpublisherFactory
- factory for creating the publisher
-
NTPublishAnnotatedOperation
public NTPublishAnnotatedOperation(InputSocket.Factory inputSocketFactory, java.lang.Class<D> dataType, java.lang.Class<P> publishType, java.util.function.Function<D,P> converter, MapNetworkPublisherFactory publisherFactory)
Creates an NTPublishAnnotatedOperation.- Parameters:
inputSocketFactory
- factory for creating the input socketsdataType
- the type of the data to publishpublishType
- the publishable analog of the data typeconverter
- function for converting instances of the input type to publishable objectspublisherFactory
- factory for creating the publisher
-
-
Method Detail
-
descriptionFor
public static OperationDescription descriptionFor(java.lang.Class<?> dataType)
Creates anOperationDescription
for anNTPublishAnnotatedOperation
that publishes data of the given type.- Parameters:
dataType
- the type of the data to publish
-
-