|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value={FIELD,METHOD,PARAMETER,TYPE}) public @interface MythProtoVersionAnnotation
This annotation specifies a MythTV protocol version range.
Depending on the MythTV protocol version the backend is speaking, different protocol commands are supported and the required request- and received response-parameters may be different. This annotation is used to specify for which MythTV-protocol versions a given protocol-request-command or protocol response-parameter is valid. It specifies a version range as an open interval.
[3,10)
:03
, but was removed in protocol version 10
.
Therefore it can only be used till version 09
.
[20,-1)
:20
and is still available in the last version
[0,20)
:20
.
Therefore the element can be used till version 19
.
[0,-1)
:here
for enumeration constants defining all known versions of the MythTV protocol.
The latest supported protocol version can be determined via ProtocolVersion.getMaxVersion()
.
The current version used by a MythTV backend connection or protocol element can be determined via
IVersionable.getVersionNr()
.
Different version can be compared using Enum.compareTo(E)
.
In the following example the method getNextFreeRecorder was introduced in version 03
and
is still valid, because no upper bound was specified.
import static org.jmythapi.protocol.ProtocolVersion.PROTO_VERSION_03; public interface IBackend extends Closeable { @MythProtoVersionAnnotation(from=PROTO_VERSION_03) public abstract IRecorderInfo getNextFreeRecorder() throws IOException; }
In the next example the backend method reactivateRecording
was introduced in version 05
but was removed in version 19
.
import static org.jmythapi.protocol.ProtocolVersion.PROTO_VERSION_05; import static org.jmythapi.protocol.ProtocolVersion.PROTO_VERSION_19; ... public interface IBackend { ... /** * @since 05 * @deprecated 19 */ @MythProtoVersionAnnotation(from = PROTO_VERSION_05, to = PROTO_VERSION_19) public abstract boolean reactivateRecording(IProgramInfo programInfo) throws IOException; ... }
toFallback
and fromFallback
properties of the annotation are specified,
and the version numbers are mentioned as "fallback-from"- and "fallback-to"-version in the functions javadoc.
In the next example the enum property REPEAT
was removed in protocol version 57
and the property REC_GROUP
was added in version 03
.
import static org.jmythapi.protocol.ProtocolVersion.PROTO_VERSION_03; import static org.jmythapi.protocol.ProtocolVersion.PROTO_VERSION_57; public interface IProgramInfo { public static enum Props { ... @MythProtoVersionAnnotation(to=PROTO_VERSION_57) REPEAT, ... @MythProtoVersionAnnotation(from=PROTO_VERSION_03) REC_GROUP, ... } }
Method parameters can also be marked with the version annotation. Parameters that are not supported in the current protocol version are just ignored or are converted into other reasonable values if possible. Read the javadoc of the method for the exact behavior.
/** * @since 00 */ @MythProtoVersionAnnotation(from = PROTO_VERSION_00) public IFileTransfer annotateFileTransfer( String fileName, @MythProtoVersionAnnotation(from = PROTO_VERSION_29) Boolean useReadAhead, @MythProtoVersionAnnotation(from = PROTO_VERSION_29) Integer retries, @MythProtoVersionAnnotation(from = PROTO_VERSION_44) String storageGroup ) throws IOException;
@mythProtoVersionRange
that generates an additional table
in javadoc, showing the protocol-range of an element including some metadata about the protocol-
versions, e.g. the commit date or a link to the Git revision when the element was added or
removed to the protocol.
here
for an example.
MythProtoVersionAnnotation
or to a ProtocolVersion
constant.
See ProtocolVersionInfo
for details.@mythProtoVersionRange
taglet.
ProtocolVersion
,
ProtocolVersionInfo
,
MythProtoVersionMetadata
,
IVersionable
Optional Element Summary | |
---|---|
ProtocolVersion |
from
Gets the MythTV-protocol version when a command or parameter was introduced. |
ProtocolVersion[] |
fromFallback
Gets fallback versions. |
MythProtoVersionMetadata[] |
fromInfo
Gets metadata about the lower protocol range. |
ProtocolVersion |
to
Gets the version when a command or parameter was removed. |
ProtocolVersion[] |
toFallback
Gets fallback versions. |
MythProtoVersionMetadata[] |
toInfo
Gets metadata about the higher protocol range. |
public abstract ProtocolVersion from
public abstract MythProtoVersionMetadata[] fromInfo
This metadata could be, e.g. the SVN-Revision or Git commit when the command or property was introduced.
public abstract ProtocolVersion to
-1
means that the command is still valid.public abstract MythProtoVersionMetadata[] toInfo
This metadata could be, e.g. the SVN-Revision or Git commit when the command or property was removed.
public abstract ProtocolVersion[] fromFallback
public abstract ProtocolVersion[] toFallback
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |