org.jmythapi.protocol.annotation
Annotation Type MythParameterDefaultValue


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

This annotation is used to define the default value of a response parameter.

The default value defined by this annotation is always of type String, even if the MythParameterType annotation is used to specified a different data-type. Therefore to set the value of a property to its default value, function IPropertyAware.setPropertyValue(int, String) must be used.

Usage example:

Specify the default value of a property:

An example hot to specify the default value of an enum property.

    public interface IProgramInfo extends IPropertyAware<IProgramInfo.Props> {
       public static enum Props {
          ...
          // SEASON has the default value 0
          @MythParameterType(Integer.class)
          @MythParameterDefaultValue("0")
          SEASON,
          ...
          // STORAGE_GROUP has the default value "Default"
          @MythParameterDefaultValue("Default")
          STORAGE_GROUP,
          ...
       }
    }
 

Query the default value of a propery:

An example how to query the default value of an enum property at runtime.

    // The following will return "Default"
    String defaultValue = GenericEnumUtils.getEnumDefaultValue(IProgramInfo.Props.STORAGE_GROUP);
    System.out.println(defaultValue);
 

See Also:
GenericEnumUtils.getEnumDefaultValue(java.lang.Enum), GenericEnumUtils.getDefaultValuesList(Class, java.util.EnumSet)

Optional Element Summary
 String value
           
 

value

public abstract String value
Default:
""


Copyright © 2008-2013. All Rights Reserved.