import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findDataSchemaNode;
import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findNodeInSchemaContext;
import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findParentModule;
-
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
final String basePackageName = BindingMapping.getRootPackageName(module.getQNameModule());
final GeneratedTypeBuilder interfaceBuilder = moduleTypeBuilder(module, "Service");
interfaceBuilder.addImplementsType(Types.typeForClass(RpcService.class));
- interfaceBuilder.setDescription(createDescription(rpcDefinitions, module.getName(), module.getModuleSourcePath()));
+ interfaceBuilder.setDescription(createDescription(rpcDefinitions, module.getName()));
for (final RpcDefinition rpc : rpcDefinitions) {
if (rpc != null) {
.setComment(encodeAngleBrackets(notification.getDescription())).setReturnType(Types.VOID);
}
}
- listenerInterface.setDescription(createDescription(notifications, module.getName(), module.getModuleSourcePath()));
+ listenerInterface.setDescription(createDescription(notifications, module.getName()));
genCtx.get(module).addTopLevelNodeType(listenerInterface);
}
return returnType;
}
- private static TypeDefinition<?> getBaseOrDeclaredType(TypeDefinition<?> typeDef) {
+ private static TypeDefinition<?> getBaseOrDeclaredType(final TypeDefinition<?> typeDef) {
if (typeDef instanceof ExtendedType) {
// Legacy behaviour returning ExtendedType is enough
return typeDef;
return list == null || list.isEmpty();
}
- private String createDescription(final Set<? extends SchemaNode> schemaNodes, final String moduleName, final String moduleSourcePath) {
+ private String createDescription(final Set<? extends SchemaNode> schemaNodes, final String moduleName) {
final StringBuilder sb = new StringBuilder();
if (!isNullOrEmpty(schemaNodes)) {
}
}
sb.append(NEW_LINE);
- sb.append("<br>(Source path: <i>");
- sb.append(moduleSourcePath);
- sb.append("</i>):");
- sb.append(NEW_LINE);
if (verboseClassComments) {
sb.append("<pre>");
sb.append(module.getName());
sb.append("</b>");
sb.append(NEW_LINE);
- sb.append("<br>(Source path: <i>");
- sb.append(module.getModuleSourcePath());
- sb.append("</i>):");
- sb.append(NEW_LINE);
sb.append("<pre>");
sb.append(NEW_LINE);
sb.append(encodeAngleBrackets(YangTemplate.generateYangSnipet(schemaNode)));
sb.append(module.getName());
sb.append("</b>");
sb.append(NEW_LINE);
- sb.append("<br>Source path: <i>");
- sb.append(module.getModuleSourcePath());
- sb.append("</i>):");
- sb.append(NEW_LINE);
sb.append("<pre>");
sb.append(NEW_LINE);
sb.append(encodeAngleBrackets(YangTemplate.generateYangSnipet(module)));
return ret.isEmpty() ? "" : ret;
}
- private void annotateDeprecatedIfNecessary(Status status, GeneratedTypeBuilder builder) {
+ private static void annotateDeprecatedIfNecessary(final Status status, final GeneratedTypeBuilder builder) {
if (status == Status.DEPRECATED) {
builder.addAnnotation("", "Deprecated");
}
import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findDataSchemaNode;
import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findDataSchemaNodeForRelativeXPath;
import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findParentModule;
-
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
} else {
dataNode = findDataSchemaNodeForRelativeXPath(schemaContext, module, parentNode, xpath);
}
- Preconditions.checkArgument(dataNode != null, "Failed to find leafref target: %s in module %s (%s) at %s",
- strXPath, this.getParentModule(parentNode).getName(),
- parentNode.getQName().getModule(), this.getParentModule(parentNode).getModuleSourcePath());
+ Preconditions.checkArgument(dataNode != null, "Failed to find leafref target: %s in module %s (%s)",
+ strXPath, this.getParentModule(parentNode).getName(), parentNode.getQName().getModule());
if (leafContainsEnumDefinition(dataNode)) {
returnType = referencedTypes.get(dataNode.getPath());
returnType = Types.typeForClass(Object.class);
}
}
- Preconditions.checkArgument(returnType != null, "Failed to find leafref target: %s in module %s (%s) at %s",
- strXPath, this.getParentModule(parentNode).getName(), parentNode.getQName().getModule(), this
- .getParentModule(parentNode).getModuleSourcePath());
+ Preconditions.checkArgument(returnType != null, "Failed to find leafref target: %s in module %s (%s)",
+ strXPath, this.getParentModule(parentNode).getName(), parentNode.getQName().getModule(), this);
return returnType;
}
return sb.toString();
}
- private static final Comparator<Bit> BIT_NAME_COMPARATOR = new Comparator<Bit>() {
- @Override
- public int compare(final Bit o1, final Bit o2) {
- return o1.getName().compareTo(o2.getName());
- }
- };
+ private static final Comparator<Bit> BIT_NAME_COMPARATOR = (o1, o2) -> o1.getName().compareTo(o2.getName());
private static String bitsToDef(final BitsTypeDefinition type, final String className, final String defaultValue, final boolean isExt) {
List<Bit> bits = new ArrayList<>(type.getBits());
}
if (module == null) {
List<Module> modulesList = new ArrayList<>(modules);
- Collections.sort(modulesList, new Comparator<Module>() {
- @Override
- public int compare(final Module o1, final Module o2) {
- return o1.getRevision().compareTo(o2.getRevision());
- }
- });
+ Collections.sort(modulesList, (o1, o2) -> o1.getRevision().compareTo(o2.getRevision()));
module = modulesList.get(0);
}
} else {
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
import com.google.common.io.ByteSource;
import java.io.File;
import java.io.IOException;
bindingGen.generateTypes(context);
fail("Expected IllegalArgumentException caused by invalid leafref path");
} catch (IllegalArgumentException e) {
- String expected = "Failed to find leafref target: ../id in module foo (QNameModule{ns=urn:yang.foo, rev=2014-03-10}) at";
+ String expected = "Failed to find leafref target: ../id in module foo (QNameModule{ns=urn:yang.foo, rev=2014-03-10})";
assertTrue(e.getMessage().startsWith(expected));
}
}