DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Flex BlazeDS Java Map To Flex Dynamic Object

01.06.2011
| 5181 views |
  • submit to reddit
        Java:
// the key must be a String
Map<String, Foo> result = new HashMap<String, Foo>();

Flex:

// injected
public var countryLabelRegexes:Object;

// example key: NATIONAL-BE
var key:String = label + REGEX_KEY_DELIMITER + (legalAddress.country as Country).isoCountryCode;

// check if the dynamic object has a property NATIONAL-BE (equivalent to java map.hasKey("NATIONAL-BE");
if(countryLabelRegexes.hasOwnProperty(key)) {
   // retrieve the value
   result = countryLabelRegexes[key];
}