org.jmythapi.protocol.annotation
Annotation Type MythParameterType


@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface MythParameterType

This annotation is used to define the data type of a response parameter.

The datatype specified with this annotation is used by IPropertyAware objects to do the "string to object conversion" of their property values, when using the functions IPropertyAware.getPropertyValueObject(Enum) and IPropertyAware.setPropertyValueObject(Enum, Object).

Usage example:

Specify the datatype of a propery:


   public interface IProgramInfo {
     public static enum Props {
       ...
       // REC_STATUS is of type ProgramRecordingStatus
       @MythParameterType(ProgramRecordingStatus.class)
       REC_STATUS,
       
       // REC_ID is of type Integer
       @MythParameterType(Integer.class)
       REC_ID,
       ...
     }
   ...
 }
 

Query the datatype of a propery:

The datatype of a property can be queried using functions of the EnumUtils class.
If a property has no datatype annotation, String is assumed as datatype of the property.

    // the following will return ProgramRecordingStatus.class
    Class clazz = EnumUtils.getEnumDataType(IProgramInfo.Props.REC_STATUS);
 

See Also:
GenericEnumUtils.getEnumDataType(Enum), IPropertyAware.getPropertyValueObject(Enum), IPropertyAware.setPropertyValueObject(Enum, Object)

Optional Element Summary
 Class<?> stringType
          The type to use when the data type should be converted to a string.
 Class<?> value
           
 

value

public abstract Class<?> value
Default:
java.lang.String.class

stringType

public abstract Class<?> stringType
The type to use when the data type should be converted to a string.

E.g. if this is a Boolean type but the stringType is set to Integer then true will be converted to 1.

See Also:
EncodingUtils.encodeObject(java.lang.Class, org.jmythapi.protocol.ProtocolVersion, S, java.lang.Class, java.lang.String)
Default:
java.lang.Object.class


Copyright © 2008-2013. All Rights Reserved.