Paul Mossman wrote: > Damian wrote: > ... >>> How can I supply Velocity an EnumSetting-typed object >> representing the >>> Polycom "voice/codecPref/OTHERS" multi-enum setting? >>> >> ConditionalSetting is just an adapter. You still should be >> able to access its type. >> >> setting.type.enums > > Arjun clarified this for me: The getType() method called on the > ConditionalSettingImpl object returns the underlying MultiEnumSetting > object. >
Some more info on that (I'll add it to wiki later) There are settings and there are settings types. Settings are just value containers, setting types allow you to interpret the value. Setting types among other things keep information about the value range (integer settings) or about the possible values (enum and multi enum settings). Every setting has a setting type associated with it (setting.getType() returns that type). A single type can be shared among many settings instances. If you look into setting.xml - <setting /> element correspond to a setting and <type /> element corresponds to setting type. MultiEnumSetting, EnumSetting, StringSetting, IntegerSetting etc. are setting types (they implement SettingType interface). ConditionalSetting is just a very specific implementation of the setting. You do not need to know if any setting happens to be an instance of a conditional setting and nothing in sipXconfig ensures or requires that any particular setting is the instance of that class. When you retrieve the value from the setting you have 2 options. getValue will always return string getTypedValue will return the value interpreted by the setting type For example setting getValue will return String "0", and getTypedValue will return an Integer 0 (that can be just assigned to int in modern Java). If you are after min/max values, accepted patterns, allowed length or enum ranges - you need to get the setting type and query it. [...] D. _______________________________________________ sipx-dev mailing list [email protected] List Archive: http://list.sipfoundry.org/archive/sipx-dev Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev sipXecs IP PBX -- http://www.sipfoundry.org/
