From 8e755f59261fc66631a8ed7a319961e5afc31d15 Mon Sep 17 00:00:00 2001 From: Mark Spruiell Date: Wed, 9 Feb 2005 18:55:46 +0000 Subject: allow metadata for dictionary types --- cpp/src/Slice/JavaUtil.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'cpp/src/Slice/JavaUtil.cpp') diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp index 5cd86656d14..5a270b708c8 100644 --- a/cpp/src/Slice/JavaUtil.cpp +++ b/cpp/src/Slice/JavaUtil.cpp @@ -455,13 +455,26 @@ Slice::JavaGenerator::typeToString(const TypePtr& type, DictionaryPtr dict = DictionaryPtr::dynamicCast(type); if(dict) { + string dictType = findMetaData(metaData); if(mode == TypeModeOut) { return getAbsolute(dict, package, "", "Holder"); } else { - return "java.util.Map"; + if(dictType.empty()) + { + StringList l = dict->getMetaData(); + dictType = findMetaData(l); + } + if(!dictType.empty()) + { + return dictType; + } + else + { + return "java.util.Map"; + } } } @@ -2452,9 +2465,9 @@ Slice::JavaGenerator::MetaDataVisitor::validate(const SyntaxTreeBasePtr& p, cons const string& file, const string& line) { // - // Currently only sequence types can be affected by metadata. + // Currently only sequence and dictionary types can be affected by metadata. // - if(!metaData.empty() && !SequencePtr::dynamicCast(p)) + if(!metaData.empty() && !SequencePtr::dynamicCast(p) && !DictionaryPtr::dynamicCast(p)) { string str; ContainedPtr cont = ContainedPtr::dynamicCast(p); -- cgit v1.2.3