import java.util.Map;
import java.util.Map.Entry;
-import org.opendaylight.yangtools.binding.generator.util.BindingGeneratorUtil;
+import org.opendaylight.mdsal.binding.generator.util.BindingGeneratorUtil;
import org.opendaylight.yangtools.yang.model.api.Module;
/**
- * Maps from module namespaces to java package names using a Map<String,
- * String>, where key is namespace prefix and value is package that replaces
- * matched prefix.
+ * Maps from module namespaces to java package names using a Map<String, String>,
+ * where key is namespace prefix and value is package that replaces matched prefix.
*/
public class PackageTranslator {
private final Map<String, String> namespacePrefixToPackageMap;
- public PackageTranslator(Map<String, String> namespacePrefixToPackageMap) {
+ public PackageTranslator(final Map<String, String> namespacePrefixToPackageMap) {
this.namespacePrefixToPackageMap = namespacePrefixToPackageMap;
}
* @throws IllegalStateException
* if there is no mapping found.
*/
- public String getPackageName(Module module) {
+ public String getPackageName(final Module module) {
Entry<String, String> longestMatch = null;
int longestMatchLength = 0;
- String namespace = module.getNamespace().toString();
- for (Entry<String, String> entry : namespacePrefixToPackageMap
+ final String namespace = module.getNamespace().toString();
+ for (final Entry<String, String> entry : this.namespacePrefixToPackageMap
.entrySet()) {
if (namespace.startsWith(entry.getKey())
- && entry.getKey().length() > longestMatchLength) {
+ && (entry.getKey().length() > longestMatchLength)) {
longestMatch = entry;
longestMatchLength = entry.getKey().length();
}
}
// TODO add to PackageTranslator
- private static String sanitizePackage(String namespace) {
+ private static String sanitizePackage(final String namespace) {
String newNamespace = namespace;
newNamespace = newNamespace.replace("://", ".");
newNamespace = newNamespace.replace("/", ".");