import static java.util.Objects.requireNonNull;
import com.google.common.annotations.Beta;
-import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import java.io.IOException;
private static final String OPENCONFIG_VERSION = OpenConfigStatements.OPENCONFIG_VERSION.getStatementName()
.getLocalName();
- @Deprecated
- private static final Splitter COLON_SPLITTER = Splitter.on(":").omitEmptyStrings().trimResults();
private final String name;
private final Revision revision;
final ImmutableSet<ModuleImport> includes,
final Optional<SemVer> semVer) {
this.name = name;
- this.revision = Revision.ofNullable(formattedRevision).orElse(null);
- this.moduleImports = imports;
- this.submoduleIncludes = includes;
- this.dependencies = ImmutableSet.<ModuleImport>builder()
+ revision = Revision.ofNullable(formattedRevision).orElse(null);
+ moduleImports = imports;
+ submoduleIncludes = includes;
+ dependencies = ImmutableSet.<ModuleImport>builder()
.addAll(moduleImports).addAll(submoduleIncludes).build();
this.semVer = semVer.orElse(null);
}
* Returns semantic version of module.
*
* @return semantic version
+ * @deprecated Semantic versioning is deprecated
*/
+ @Deprecated(since = "8.0.4", forRemoval = true)
public Optional<SemVer> getSemanticVersion() {
return Optional.ofNullable(semVer);
}
static String safeStringArgument(final SourceIdentifier source, final IRStatement stmt, final String desc) {
final StatementSourceReference ref = getReference(source, stmt);
final IRArgument arg = stmt.argument();
- checkArgument(arg != null, "Missing %s at %s", desc, ref);
+ if (arg == null) {
+ throw new IllegalArgumentException("Missing " + desc + " at " + ref);
+ }
+
// TODO: we probably need to understand yang version first....
return ArgumentContextUtils.rfc6020().stringFromStringContext(arg, ref);
}
/**
* Returns name of parent module.
+ *
+ * @return The module this info belongs to
*/
public String getParentModule() {
return belongsTo;
ModuleImportImpl(final @NonNull String moduleName, final @Nullable Revision revision,
final @Nullable SemVer semVer) {
- this.name = requireNonNull(moduleName, "Module name must not be null.");
+ name = requireNonNull(moduleName, "Module name must not be null.");
this.revision = revision;
this.semVer = semVer;
}
}
@Override
+ @Deprecated(forRemoval = true)
public Optional<SemVer> getSemanticVersion() {
return Optional.ofNullable(semVer);
}
@Override
public String getPrefix() {
- return null;
+ throw new UnsupportedOperationException();
}
@Override