Monday, September 5, 2011

Flex :: Metadata tag - Deprecated

The [Deprecated] metadata tag marks class or class elements deprecated so that the compiler can recognize it and issue a warning when the element is used in an application.

The [Deprecated] metadata tag syntax is as follow

[Deprecated("string_describing_deprecation")]
[Deprecated(message="string_describing_deprecation")]
[Deprecated(replacement="string_specifying_replaceent")]
[Deprecated(replacement="string_specifying_replaceent",                   since="version_of_replacement")]

Insert the [Deprecated] metadata tag before a property, method or class definition to mark that element as deprecated.

[Deprecated(replacement="mycomponent.label")]
public function set text( val:String ):void
{
   ...
}

The [Event], [Effect] and [Style] metadata tag also support deprecation.
These metadata tags support the deprecatedReplacement, deprecatedSince and deprecatedMessage attributes to mark event, effect and style as deprecated.

[Event(... , deprecatedReplacement="string_specifying_replacement",
             deprecatedSince="version_of_replacement" )]

Note: For a command line compiler use show-deprecation-warnings option and set it to true.

No comments:

Post a Comment