Creates a map of all possible parameter names to their corresponding object. No two parameters may have the same name. @param params the list of parameters to create a map for @return a map of string names to their parameters @throws RuntimeException if two parameters have the same name
(List<Parameter> params)
| 170 | * @throws RuntimeException if two parameters have the same name |
| 171 | */ |
| 172 | public static Map<String, Parameter> toParameterMap(List<Parameter> params) |
| 173 | { |
| 174 | Map<String, Parameter> map = new HashMap<String, Parameter>(params.size()); |
| 175 | for(Parameter param : params) |
| 176 | { |
| 177 | if(map.put(param.getASCIIName(), param) != null) |
| 178 | throw new RuntimeException("Name collision, two parameters use the name '" + param.getASCIIName() + "'"); |
| 179 | if(!param.getName().equals(param.getASCIIName()))//Dont put it in again |
| 180 | if(map.put(param.getName(), param) != null) |
| 181 | throw new RuntimeException("Name collision, two parameters use the name '" + param.getName() + "'"); |
| 182 | } |
| 183 | return map; |
| 184 | } |
| 185 | |
| 186 | /** |
| 187 | * Given an object, this method will use reflection to automatically find |