X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=binding2%2Fmdsal-binding2-generator-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fbinding%2Fjavav2%2Fgenerator%2Fimpl%2FAugmentToGenType.java;h=641b71232c5cac92d30cff32516452df569cddd1;hb=b1fa86d7d82b6f20576b8b1f94af90081b44a3e6;hp=2c2f77027704aec7b3df83fe03965876e313a02b;hpb=1a500171a83bb142b59c26597e7581832fb98554;p=mdsal.git diff --git a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenType.java b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenType.java index 2c2f770277..641b71232c 100644 --- a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenType.java +++ b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenType.java @@ -166,15 +166,19 @@ final class AugmentToGenType { final Set augmentations = module.getAugmentations(); final List sortedAugmentations = new ArrayList<>(augmentations).stream() - .filter(aug -> !module.equals(schemaContext.findModuleByNamespaceAndRevision( - aug.getTargetPath().getLastComponent().getNamespace(), - aug.getTargetPath().getLastComponent().getRevision()))) + .filter(aug -> !module.equals(findAugmentTargetModule(schemaContext, aug))) .collect(Collectors.toList()); Collections.sort(sortedAugmentations, AUGMENT_COMP); return sortedAugmentations; } + public static Module findAugmentTargetModule(final SchemaContext schemaContext , final AugmentationSchema aug) { + Preconditions.checkNotNull(aug, "Augmentation schema can not be null."); + final QName first = aug.getTargetPath().getPathFromRoot().iterator().next(); + return schemaContext.findModuleByNamespaceAndRevision(first.getNamespace(), first.getRevision()); + } + /** * Converts augSchema to list of Type which * contains generated type for augmentation. In addition there are also