Fix checkstyle warnings in yang-jmx-generator.
[controller.git] / opendaylight / config / yang-jmx-generator / src / test / java / org / opendaylight / controller / config / yangjmxgenerator / plugin / util / YangModelSearchUtils.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.config.yangjmxgenerator.plugin.util;
9
10 import com.google.common.base.Preconditions;
11 import java.util.Collection;
12 import java.util.HashMap;
13 import java.util.Map;
14 import org.opendaylight.yangtools.yang.model.api.Module;
15
16 public class YangModelSearchUtils {
17
18     public static Map<String, Module> mapModulesByNames(
19             Collection<Module> modules) {
20         Map<String, Module> result = new HashMap<>();
21         for (Module m : modules) {
22             String moduleName = m.getName();
23             Preconditions.checkArgument(
24                     result.containsKey(moduleName) == false,
25                     "Two modules have same name " + moduleName);
26             result.put(moduleName, m);
27         }
28         return result;
29     }
30 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.