|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jmythapi.impl.AData<E> org.jmythapi.protocol.response.impl.AMythResponse<E>
public abstract class AMythResponse<E extends Enum<E>>
Field Summary |
---|
Fields inherited from class org.jmythapi.impl.AData |
---|
logger, propsClass, protoVersion, respArgs |
Constructor Summary | |
---|---|
AMythResponse(Class<E> propsClass,
IMythPacket packet)
A constructor to create a response object from a given packet object. |
|
AMythResponse(ProtocolVersion protoVersion,
Class<E> propsClass)
A constructor to create a response object with an empty response-arguments list. |
|
AMythResponse(ProtocolVersion protoVersion,
Class<E> propsClass,
List<String> responseArgs)
A constructor to create a response object from the given response-arguments list. |
|
AMythResponse(ProtocolVersion protoVersion,
Class<E> propsClass,
String... responseArgs)
A constructor to create a response object from the given response-arguments array. |
Method Summary | ||
---|---|---|
protected void |
checkSize(List<String> responseArgs)
A function to check if the given response-argument-liste contains all expected arguments. |
|
protected
|
decodeProperty(Class<T> dataType,
String dataValue)
|
|
protected
|
encodeProperty(Class<S> propObjectType,
S propValue,
Class<T> propStringType,
String propDefaultValue)
|
|
protected int |
getExpectedSize(List<String> responseArgs)
This function returns the expected size of the response-argument-list. |
|
IMythPacket |
getPacket()
Converts this response-object into a IMythPacket . |
|
EnumSet<E> |
getProperties()
Returns all supported properties. |
|
E |
getProperty(int idx)
Gets the property for the given index. |
|
int |
getPropertyIndex(E prop)
Gets the index for the given property. |
Methods inherited from class org.jmythapi.impl.AData |
---|
clone, equals, getPropertyClass, getPropertyCount, getPropertyMap, getPropertyValue, getPropertyValue, getPropertyValueObject, getPropertyValueObject, getPropertyValues, getVersionNr, hashCode, init, postProcessArguments, setPropertyValue, setPropertyValue, setPropertyValueObject, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jmythapi.IPropertyAware |
---|
getPropertyClass, getPropertyCount, getPropertyMap, getPropertyValue, getPropertyValue, getPropertyValueObject, getPropertyValues, setPropertyValue, setPropertyValue, setPropertyValueObject |
Methods inherited from interface org.jmythapi.IVersionable |
---|
getVersionNr |
Constructor Detail |
---|
public AMythResponse(ProtocolVersion protoVersion, Class<E> propsClass)
This constructor should be used if the response properties should be set via the corresponding setter methods afterwards.
protoVersion
- the protocol versionpropsClass
- a enumeration class defining all supported response propertiespublic AMythResponse(Class<E> propsClass, IMythPacket packet)
propsClass
- a enumeration class defining all supported response properties.packet
- the packet object.public AMythResponse(ProtocolVersion protoVersion, Class<E> propsClass, String... responseArgs)
protoVersion
- the protocol version.propsClass
- a enumeration class defining all supported response propertiesresponseArgs
- the array of response argumentspublic AMythResponse(ProtocolVersion protoVersion, Class<E> propsClass, List<String> responseArgs)
protoVersion
- the protocol version.propsClass
- a enumeration class defining all supported response propertiesresponseArgs
- the list of response arguments.Method Detail |
---|
public IMythPacket getPacket()
Converts this response-object into a IMythPacket
.
getPacket
in interface ISendable
public E getProperty(int idx)
IPropertyAware
This is the reverse operation of IPropertyAware.getPropertyIndex(Enum)
.
for(int i=0; i < object.getPropertyCount(); i++) { System.out.println(String.format( "Property %02d: %s", i, object.getProperty(i) )); }
getProperty
in interface IPropertyAware<E extends Enum<E>>
getProperty
in class AData<E extends Enum<E>>
idx
- the position within the property array
public int getPropertyIndex(E prop)
IPropertyAware
This is the reverse operation of IPropertyAware.getProperty(int)
-1
is returned.
EnumSet<IProgramInfo.Props> props = program.getProperties(); for(IProgramInfo.Props prop : props) { System.out.println(String.format( "Property %s is stored at position %d.", prop.name(), program.getPropertyIndex(prop) )); }
getPropertyIndex
in interface IPropertyAware<E extends Enum<E>>
getPropertyIndex
in class AData<E extends Enum<E>>
prop
- the property for which the index should be returned
-1
, if a property is not supported in
the currently used protocol version.public EnumSet<E> getProperties()
IPropertyAware
getProperties
in interface IPropertyAware<E extends Enum<E>>
getProperties
in class AData<E extends Enum<E>>
protected <T> T decodeProperty(Class<T> dataType, String dataValue)
decodeProperty
in class AData<E extends Enum<E>>
protected <S,T> String encodeProperty(Class<S> propObjectType, S propValue, Class<T> propStringType, String propDefaultValue)
encodeProperty
in class AData<E extends Enum<E>>
protected int getExpectedSize(List<String> responseArgs)
This function returns the expected size of the response-argument-list.
The expected size may be different depending on the current MythTV-protocol-version.EnumUtils#getEnumLength(Class, int)
to determine the expected size of the argument-list.
responseArgs
- the response-argument-listprotected void checkSize(List<String> responseArgs) throws IllegalArgumentException
A function to check if the given response-argument-liste contains all expected arguments.
The expected argument-list-size is calculated using#getExpectedSize(ArrayList)
.
responseArgs
- the response-argument-list
IllegalArgumentException
- if expected arguments are missing.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |