org.jmythapi.protocol
Class ProtocolVersionRange

java.lang.Object
  extended by org.jmythapi.impl.AVersionRange<ProtocolVersion>
      extended by org.jmythapi.protocol.ProtocolVersionRange

public class ProtocolVersionRange
extends AVersionRange<ProtocolVersion>

This class represents a MythTV protocol version range.
It is mainly used by utility classes, such as EnumUtils or CommandUtils, to determine the valid protocol-version range for a response property or command.

See MythProtoVersionAnnotation for more information about protocol version ranges.

See Also:
CommandUtils.getCommandVersionRange(String), EnumUtils.getEnumVersionRange(Enum)

Field Summary
static ProtocolVersionRange DEFAULT_RANGE
          The default protocol-version range.
 
Fields inherited from class org.jmythapi.impl.AVersionRange
fromVersion, toVersion
 
Constructor Summary
ProtocolVersionRange(MythProtoVersionAnnotation versionRange)
          Constructs a version-range object from an protocol-version annotation
ProtocolVersionRange(ProtocolVersion from, Map<String,String> fromMetaData, ProtocolVersion fromFallback, ProtocolVersion to, Map<String,String> toMetaData, ProtocolVersion toFallback)
           
ProtocolVersionRange(ProtocolVersion from, ProtocolVersion to)
           
 
Method Summary
 ProtocolVersion fromFallback()
           
 Map<String,String> fromInfo()
           
 boolean isInRange(int protoVersionNr)
          Checks if the specified protocol-version is in this version-range.
 ProtocolVersionRange restrictRange(ProtocolVersionRange parentRange)
          Generates a new protocol-version-range depending on the values of this range and a parent range.
 ProtocolVersion toFallback()
           
 Map<String,String> toInfo()
           
 
Methods inherited from class org.jmythapi.impl.AVersionRange
equals, from, isInRange, to, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_RANGE

public static final ProtocolVersionRange DEFAULT_RANGE
The default protocol-version range.

This range is used for commands or properties if no other range was specified via an MythProtoVersionAnnotation.

See Also:
CommandUtils.getCommandVersionRange(String), EnumUtils.getEnumVersionRange(Enum)
Constructor Detail

ProtocolVersionRange

public ProtocolVersionRange(MythProtoVersionAnnotation versionRange)
Constructs a version-range object from an protocol-version annotation

Parameters:
versionRange - the protocol-version-annotation

ProtocolVersionRange

public ProtocolVersionRange(ProtocolVersion from,
                            ProtocolVersion to)

ProtocolVersionRange

public ProtocolVersionRange(ProtocolVersion from,
                            Map<String,String> fromMetaData,
                            ProtocolVersion fromFallback,
                            ProtocolVersion to,
                            Map<String,String> toMetaData,
                            ProtocolVersion toFallback)
Method Detail

fromInfo

public Map<String,String> fromInfo()

fromFallback

public ProtocolVersion fromFallback()

toInfo

public Map<String,String> toInfo()

toFallback

public ProtocolVersion toFallback()

isInRange

public boolean isInRange(int protoVersionNr)
Description copied from class: AVersionRange
Checks if the specified protocol-version is in this version-range.

Specified by:
isInRange in class AVersionRange<ProtocolVersion>
Parameters:
protoVersionNr - the protocol-version to check
Returns:
true if the given version is in the range.

restrictRange

public ProtocolVersionRange restrictRange(ProtocolVersionRange parentRange)
Generates a new protocol-version-range depending on the values of this range and a parent range.

Parameters:
parentRange - the parent version range
Returns:
the new version range


Copyright © 2008-2013. All Rights Reserved.