*/
package org.opendaylight.yangtools.yang.model.repo.api;
-import static java.util.Objects.requireNonNull;
-
import com.google.common.annotations.Beta;
import java.util.Objects;
import java.util.Optional;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.yang.common.Revision;
/**
* YANG Schema revision source identifier.
*
* <p>
- * Simple transfer object represents revision identifier of source for YANG
- * schema (module or submodule), which consists of
+ * Simple transfer object represents revision identifier of source for YANG schema (module or submodule), which consists
+ * of
* <ul>
* <li>YANG schema name ({@link #getName()}
* <li>Module revision (optional) ({link {@link #getRevision()})
* </ul>
*
* <p>
- * Revision source identifier is designated to be carry only necessary
- * information to look-up YANG model source and to be used by various
- * SchemaSourceProviders.
+ * Revision source identifier is designated to be carry only necessary information to look-up YANG model source
+ * and to be used by various SchemaSourceProviders.
*
* <p>
- * <b>Note:</b>On source retrieval layer it is impossible to distinguish between
- * YANG module and/or submodule unless source is present.
+ * <b>Note:</b>On source retrieval layer it is impossible to distinguish between YANG module and/or submodule unless
+ * source is present.
*
* <p>
* (For further reference see: http://tools.ietf.org/html/rfc6020#section-5.2
private static final long serialVersionUID = 1L;
/**
- * Creates new YANG Schema revision source identifier for sources without
- * a revision.
+ * Creates new YANG Schema revision source identifier for sources without a revision.
*
- * @param name
- * Name of schema
+ * @param name Name of schema
*/
RevisionSourceIdentifier(final String name) {
super(name);
/**
* Creates new YANG Schema revision source identifier.
*
- * @param name
- * Name of schema
- * @param revision
- * Revision of source, may be null
+ * @param name Name of schema
+ * @param revision Revision of source, may be null
*/
- RevisionSourceIdentifier(final String name, @Nullable final Revision revision) {
- super(requireNonNull(name), revision);
+ RevisionSourceIdentifier(final String name, final @Nullable Revision revision) {
+ super(name, revision);
}
/**
* Creates new YANG Schema revision source identifier.
*
- * @param name
- * Name of schema
- * @param formattedRevision
- * Revision of source, potentially not present
+ * @param name Name of schema
+ * @param formattedRevision Revision of source, potentially not present
*/
private RevisionSourceIdentifier(final String name, final Optional<Revision> revision) {
super(name, revision);
/**
* Creates new YANG Schema revision source identifier.
*
- * @param moduleName
- * Name of schema
- * @param revision
- * Revision of source in format YYYY-mm-dd. If not present,
- * default value will be used.
+ * @param moduleName Name of schema
+ * @param revision Revision of source in format YYYY-mm-dd. If not present, default value will be used.
*/
- public static RevisionSourceIdentifier create(final String moduleName, final Optional<Revision> revision) {
+ public static @NonNull RevisionSourceIdentifier create(final String moduleName, final Optional<Revision> revision) {
return new RevisionSourceIdentifier(moduleName, revision);
}
/**
* Creates new YANG Schema revision source identifier.
*
- * @param moduleName
- * Name of schema
- * @param revision
- * Revision of source, may be null
+ * @param moduleName Name of schema
+ * @param revision Revision of source, may be null
*/
- public static RevisionSourceIdentifier create(final String moduleName, @Nullable final Revision revision) {
+ public static @NonNull RevisionSourceIdentifier create(final String moduleName, final @Nullable Revision revision) {
return new RevisionSourceIdentifier(moduleName, revision);
}
* @param moduleName
* Name of schema
*/
- public static RevisionSourceIdentifier create(final String moduleName) {
+ public static @NonNull RevisionSourceIdentifier create(final String moduleName) {
return new RevisionSourceIdentifier(moduleName);
}
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collection;
import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@Beta
public interface SchemaContextFactory {
/**
- * Create a new schema context containing specified sources, pulling in any
- * dependencies they may have.
+ * Create a new schema context containing specified sources, pulling in any dependencies they may have.
*
- * @param requiredSources
- * a collection of sources which are required to be present
- * @return A checked future, which will produce a schema context, or fail
- * with an explanation why the creation of the schema context
- * failed.
+ * @param requiredSources a collection of sources which are required to be present
+ * @return A checked future, which will produce a schema context, or fail with an explanation why the creation
+ * of the schema context failed.
*/
- ListenableFuture<SchemaContext> createSchemaContext(@Nonnull Collection<SourceIdentifier> requiredSources);
+ @NonNull ListenableFuture<SchemaContext> createSchemaContext(@NonNull Collection<SourceIdentifier> requiredSources);
/**
- * Create a new schema context containing specified sources, pulling in any
- * dependencies they may have.
+ * Create a new schema context containing specified sources, pulling in any dependencies they may have.
*
- * @param requiredSources
- * a collection of sources which are required to be present
- * @param statementParserMode
- * mode of statement parser
- * @return A checked future, which will produce a schema context, or fail
- * with an explanation why the creation of the schema context
- * failed.
+ * @param requiredSources a collection of sources which are required to be present
+ * @param statementParserMode mode of statement parser
+ * @return A future which will produce a schema context, or fail with an explanation why the creation
+ * of the schema context failed.
* @deprecated Use SchemaContextFactoryConfiguration instead.
*/
@Deprecated
- default ListenableFuture<SchemaContext> createSchemaContext(final Collection<SourceIdentifier> requiredSources,
- final StatementParserMode statementParserMode) {
+ default @NonNull ListenableFuture<SchemaContext> createSchemaContext(
+ final Collection<SourceIdentifier> requiredSources, final StatementParserMode statementParserMode) {
return createSchemaContext(requiredSources, statementParserMode, null);
}
/**
- * Create a new schema context containing specified sources, pulling in any
- * dependencies they may have.
+ * Create a new schema context containing specified sources, pulling in any dependencies they may have.
*
- * @param requiredSources
- * a collection of sources which are required to be present
- * @param supportedFeatures
- * set of supported features based on which all if-feature
- * statements in the parsed yang models are resolved
- * @return A checked future, which will produce a schema context, or fail
- * with an explanation why the creation of the schema context
- * failed.
+ * @param requiredSources a collection of sources which are required to be present
+ * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
+ * models are resolved
+ * @return A future which will produce a schema context, or fail with an explanation why the creation of the schema
+ * context failed.
* @deprecated Use SchemaContextFactoryConfiguration instead.
*/
@Deprecated
- default ListenableFuture<SchemaContext> createSchemaContext(
- @Nonnull final Collection<SourceIdentifier> requiredSources, final Set<QName> supportedFeatures) {
+ default @NonNull ListenableFuture<SchemaContext> createSchemaContext(
+ final @NonNull Collection<SourceIdentifier> requiredSources, final Set<QName> supportedFeatures) {
return createSchemaContext(requiredSources, StatementParserMode.DEFAULT_MODE, supportedFeatures);
}
/**
- * Create a new schema context containing specified sources, pulling in any
- * dependencies they may have.
+ * Create a new schema context containing specified sources, pulling in any dependencies they may have.
*
- * @param requiredSources
- * a collection of sources which are required to be present
- * @param statementParserMode
- * mode of statement parser
- * @param supportedFeatures
- * set of supported features based on which all if-feature
- * statements in the parsed yang models are resolved
- * @return A checked future, which will produce a schema context, or fail
- * with an explanation why the creation of the schema context
- * failed.
+ * @param requiredSources a collection of sources which are required to be present
+ * @param statementParserMode mode of statement parser
+ * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
+ * models are resolved
+ * @return A future which will produce a schema context, or fail with an explanation why the creation of the schema
+ * context failed.
* @deprecated Use SchemaContextFactoryConfiguration instead.
*/
@Deprecated
- ListenableFuture<SchemaContext> createSchemaContext(Collection<SourceIdentifier> requiredSources,
+ @NonNull ListenableFuture<SchemaContext> createSchemaContext(Collection<SourceIdentifier> requiredSources,
StatementParserMode statementParserMode, Set<QName> supportedFeatures);
}
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
* SchemaContextFactory configuration class.
*
* <p>
- * SchemaContextFactoryConfiguration supports currently the following options to
- * be set:
+ * SchemaContextFactoryConfiguration supports currently the following options to be set:
* <ul>
* <li>schema source filter</li>
* <li>statement parser mode</li>
*/
@Beta
public final class SchemaContextFactoryConfiguration implements Immutable {
- private static final SchemaContextFactoryConfiguration DEFAULT_CONFIGURATION = new Builder().build();
+ private static final @NonNull SchemaContextFactoryConfiguration DEFAULT_CONFIGURATION = new Builder().build();
- private final SchemaSourceFilter filter;
- private final StatementParserMode statementParserMode;
- private final Set<QName> supportedFeatures;
- private final SetMultimap<QNameModule, QNameModule> modulesDeviatedByModules;
+ private final @NonNull SchemaSourceFilter filter;
+ private final @NonNull StatementParserMode statementParserMode;
+ private final @Nullable Set<QName> supportedFeatures;
+ private final @Nullable SetMultimap<QNameModule, QNameModule> modulesDeviatedByModules;
- private SchemaContextFactoryConfiguration(final SchemaSourceFilter filter,
- final StatementParserMode statementParserMode, final Set<QName> supportedFeatures,
- final SetMultimap<QNameModule, QNameModule> modulesDeviatedByModules) {
+ private SchemaContextFactoryConfiguration(final @NonNull SchemaSourceFilter filter,
+ final @NonNull StatementParserMode statementParserMode, final @Nullable Set<QName> supportedFeatures,
+ final @Nullable SetMultimap<QNameModule, QNameModule> modulesDeviatedByModules) {
this.filter = requireNonNull(filter);
this.statementParserMode = requireNonNull(statementParserMode);
this.supportedFeatures = supportedFeatures;
this.modulesDeviatedByModules = modulesDeviatedByModules;
}
- public SchemaSourceFilter getSchemaSourceFilter() {
+ public @NonNull SchemaSourceFilter getSchemaSourceFilter() {
return filter;
}
- public StatementParserMode getStatementParserMode() {
+ public @NonNull StatementParserMode getStatementParserMode() {
return statementParserMode;
}
return Optional.ofNullable(modulesDeviatedByModules);
}
- public static SchemaContextFactoryConfiguration getDefault() {
+ public static @NonNull SchemaContextFactoryConfiguration getDefault() {
return DEFAULT_CONFIGURATION;
}
- public static Builder builder() {
+ public static @NonNull Builder builder() {
return new Builder();
}
private Set<QName> supportedFeatures;
/**
- * Set schema source filter which will filter available schema sources
- * using the provided filter.
+ * Set schema source filter which will filter available schema sources using the provided filter.
*
- * @param filter
- * schema source filter which acts as the gating function
- * before a schema source is considered by the factory for
- * inclusion in the SchemaContext it produces.
+ * @param filter schema source filter which acts as the gating function before a schema source is considered
+ * by the factory for inclusion in the SchemaContext it produces.
* @return this builder
*/
- public Builder setFilter(@Nonnull final SchemaSourceFilter filter) {
+ public @NonNull Builder setFilter(final @NonNull SchemaSourceFilter filter) {
this.filter = requireNonNull(filter);
return this;
}
/**
- * Set yang statement parser mode.
+ * Set YANG statement parser mode.
*
- * @param statementParserMode
- * mode of yang statement parser
+ * @param statementParserMode mode of yang statement parser
* @return this builder
*/
- public Builder setStatementParserMode(@Nonnull final StatementParserMode statementParserMode) {
+ public @NonNull Builder setStatementParserMode(final @NonNull StatementParserMode statementParserMode) {
this.statementParserMode = requireNonNull(statementParserMode);
return this;
}
/**
- * Set supported features based on which all if-feature statements in
- * the parsed YANG modules will be resolved.
+ * Set supported features based on which all if-feature statements in the parsed YANG modules will be resolved.
*
- * @param supportedFeatures
- * Set of supported features in the final SchemaContext. If
- * the set is empty, no features encountered will be
- * supported.
+ * @param supportedFeatures Set of supported features in the final SchemaContext. If the set is empty, no
+ * features encountered will be supported.
* @return this builder
*/
- public Builder setSupportedFeatures(final Set<QName> supportedFeatures) {
+ public @NonNull Builder setSupportedFeatures(final Set<QName> supportedFeatures) {
this.supportedFeatures = supportedFeatures != null ? ImmutableSet.copyOf(supportedFeatures) : null;
return this;
}
/**
- * Set YANG modules which can be deviated by specified modules during
- * the parsing process. Map key (QNameModule) denotes a module which can
- * be deviated by the modules in the Map value.
+ * Set YANG modules which can be deviated by specified modules during the parsing process. Map key (QNameModule)
+ * denotes a module which can be deviated by the modules in the Map value.
*
- * @param modulesDeviatedByModules
- * Map of YANG modules (Map key) which can be deviated by
- * specified modules (Map values) in the final SchemaContext.
- * If the map is empty, no deviations encountered will be
- * supported. If the map is null, all deviations will be applied.
+ * @param modulesDeviatedByModules Map of YANG modules (Map key) which can be deviated by specified modules
+ * (Map values) in the final SchemaContext. If the map is empty, no deviations
+ * encountered will be supported. If the map is null, all deviations will be
+ * applied.
* @return this builder
*/
- public Builder setModulesDeviatedByModules(
- final SetMultimap<QNameModule, QNameModule> modulesDeviatedByModules) {
+ public @NonNull Builder setModulesDeviatedByModules(
+ final @Nullable SetMultimap<QNameModule, QNameModule> modulesDeviatedByModules) {
this.modulesDeviatedByModules = modulesDeviatedByModules != null
? ImmutableSetMultimap.copyOf(modulesDeviatedByModules) : null;
return this;
}
@Override
- public SchemaContextFactoryConfiguration build() {
+ public @NonNull SchemaContextFactoryConfiguration build() {
return new SchemaContextFactoryConfiguration(filter, statementParserMode, supportedFeatures,
modulesDeviatedByModules);
}
}
-}
\ No newline at end of file
+}
import com.google.common.annotations.Beta;
import com.google.common.util.concurrent.ListenableFuture;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
/**
- * Interface exposed by repository implementations. A schema repository is a logically
- * centralized place for model storage and creation of {@link SchemaContext} instances.
+ * Interface exposed by repository implementations. A schema repository is a logically centralized place for model
+ * storage and creation of {@link SchemaContext} instances.
*/
@Beta
public interface SchemaRepository {
/**
- * Instantiate a new {@link SchemaContextFactory}, which will filter
- * available schema sources using the provided filter.
+ * Instantiate a new {@link SchemaContextFactory}, which will filter available schema sources using the provided
+ * filter.
*
- * @param filter
- * Filter which acts as the gating function before a schema
- * source is considered by the factory for inclusion in the
- * {@link SchemaContext} it produces.
+ * @param filter Filter which acts as the gating function before a schema source is considered by the factory
+ * for inclusion in the {@link SchemaContext} it produces.
* @return A new schema context factory.
- * @deprecated Use
- * {@link #createSchemaContextFactory(SchemaContextFactoryConfiguration)}
- * instead.
+ * @deprecated Use {@link #createSchemaContextFactory(SchemaContextFactoryConfiguration)} instead.
*/
@Deprecated
- SchemaContextFactory createSchemaContextFactory(@Nonnull SchemaSourceFilter filter);
+ @NonNull SchemaContextFactory createSchemaContextFactory(@NonNull SchemaSourceFilter filter);
/**
* Returns {@link SchemaContextFactory} with supplied configuration.
*
- * @param config
- * configuration of schema context factory.
+ * @param config configuration of schema context factory.
* @return schema context factory.
*/
- SchemaContextFactory createSchemaContextFactory(@Nonnull SchemaContextFactoryConfiguration config);
+ @NonNull SchemaContextFactory createSchemaContextFactory(@NonNull SchemaContextFactoryConfiguration config);
- <T extends SchemaSourceRepresentation> ListenableFuture<T> getSchemaSource(@Nonnull SourceIdentifier id,
- @Nonnull Class<T> represetation);
+ <T extends SchemaSourceRepresentation> @NonNull ListenableFuture<T> getSchemaSource(@NonNull SourceIdentifier id,
+ @NonNull Class<T> represetation);
}
import com.google.common.collect.Multimap;
import java.util.Collection;
import java.util.Collections;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.ModuleImport;
/**
private static final long serialVersionUID = 1L;
private final SourceIdentifier failedSource;
- private final Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports;
- private final Collection<SourceIdentifier> resolvedSources;
+ private final @NonNull Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports;
+ private final @NonNull Collection<SourceIdentifier> resolvedSources;
- public SchemaResolutionException(@Nonnull final String message) {
+ public SchemaResolutionException(final @NonNull String message) {
this(message, null);
}
- public SchemaResolutionException(@Nonnull final String message, final Throwable cause) {
+ public SchemaResolutionException(final @NonNull String message, final Throwable cause) {
this(message, null, cause, Collections.emptySet(), ImmutableMultimap.of());
}
- public SchemaResolutionException(@Nonnull final String message, final SourceIdentifier failedSource,
+ public SchemaResolutionException(final @NonNull String message, final SourceIdentifier failedSource,
final Throwable cause) {
this(message, failedSource, cause, Collections.emptySet(), ImmutableMultimap.of());
}
- public SchemaResolutionException(@Nonnull final String message, final Collection<SourceIdentifier> resolvedSources,
- final @Nonnull Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports) {
+ public SchemaResolutionException(final @NonNull String message,
+ final @NonNull Collection<SourceIdentifier> resolvedSources,
+ final @NonNull Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports) {
this(message, null, null, resolvedSources, unsatisfiedImports);
}
- public SchemaResolutionException(@Nonnull final String message, final SourceIdentifier failedSource,
- final Throwable cause, @Nonnull final Collection<SourceIdentifier> resolvedSources,
- @Nonnull final Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports) {
+ public SchemaResolutionException(final @NonNull String message, final SourceIdentifier failedSource,
+ final Throwable cause, final @NonNull Collection<SourceIdentifier> resolvedSources,
+ final @NonNull Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports) {
super(formatMessage(message, failedSource, resolvedSources, unsatisfiedImports), cause);
this.failedSource = failedSource;
this.unsatisfiedImports = ImmutableMultimap.copyOf(unsatisfiedImports);
}
/**
- * Return the list of sources which failed to resolve along with reasons
- * why they were not resolved.
+ * Return the list of sources which failed to resolve along with reasons why they were not resolved.
*
* @return Source/reason map.
*/
- public final Multimap<SourceIdentifier, ModuleImport> getUnsatisfiedImports() {
+ public final @NonNull Multimap<SourceIdentifier, ModuleImport> getUnsatisfiedImports() {
return unsatisfiedImports;
}
-
// FIXME: should be leak actual mapping?
- public final Collection<SourceIdentifier> getResolvedSources() {
+ public final @NonNull Collection<SourceIdentifier> getResolvedSources() {
return resolvedSources;
}
import com.google.common.annotations.Beta;
import java.util.Objects;
import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.common.Revision;
* YANG Schema source identifier with specified semantic version.
*
* <p>
- * Simple transfer object represents identifier of source for YANG schema
- * (module or submodule), which consists of
+ * Simple transfer object represents identifier of source for YANG schema (module or submodule), which consists of
* <ul>
* <li>YANG schema name {@link #getName()}
* <li>Semantic version of yang schema {@link #getSemanticVersion()}
* </ul>
*
* <p>
- * Source identifier is designated to be carry only necessary information to
- * look-up YANG model source and to be used by various SchemaSourceProviders.
+ * Source identifier is designated to be carry only necessary information to look-up YANG model source and to be used
+ * by various SchemaSourceProviders.
*
* <p>
- * <b>Note:</b>On source retrieval layer it is impossible to distinguish between
- * YANG module and/or submodule unless source is present.
+ * <b>Note:</b>On source retrieval layer it is impossible to distinguish between YANG module and/or submodule unless
+ * source is present.
*
* <p>
* (For further reference see: http://tools.ietf.org/html/rfc6020#section-5.2
/**
* Creates new YANG Schema semVer source identifier.
*
- * @param name
- * Name of schema
- * @param revision
- * Revision of source, possibly not present
- * @param semVer
- * semantic version of source
+ * @param name Name of schema
+ * @param revision Revision of source, possibly not present
+ * @param semVer semantic version of source
*/
- SemVerSourceIdentifier(final String name, final Optional<Revision> revision, final SemVer semVer) {
+ SemVerSourceIdentifier(final String name, final Optional<Revision> revision, final @Nullable SemVer semVer) {
super(name, revision);
this.semVer = semVer;
}
/**
* Creates new YANG Schema semVer source identifier.
*
- * @param name
- * Name of schema
- * @param semVer
- * semantic version of source
+ * @param name Name of schema
+ * @param semVer semantic version of source
*/
- SemVerSourceIdentifier(final String name, final SemVer semVer) {
+ SemVerSourceIdentifier(final String name, final @Nullable SemVer semVer) {
this(name, Optional.empty(), semVer);
}
/**
* Creates new YANG Schema semVer source identifier.
*
- * @param moduleName
- * Name of schema
- * @param semVer
- * semantic version of source
+ * @param moduleName Name of schema
+ * @param semVer semantic version of source
*/
- public static SemVerSourceIdentifier create(final String moduleName, final SemVer semVer) {
+ public static @NonNull SemVerSourceIdentifier create(final String moduleName, final SemVer semVer) {
return new SemVerSourceIdentifier(moduleName, semVer);
}
/**
* Creates new YANG Schema semVer source identifier.
*
- * @param moduleName
- * Name of schema
- * @param revision
- * Revision of source in format YYYY-mm-dd
- * @param semVer
- * semantic version of source
+ * @param moduleName Name of schema
+ * @param revision Revision of source in format YYYY-mm-dd
+ * @param semVer semantic version of source
*/
- public static SemVerSourceIdentifier create(final String moduleName, final Revision revision,
+ public static @NonNull SemVerSourceIdentifier create(final String moduleName, final Revision revision,
final SemVer semVer) {
return new SemVerSourceIdentifier(moduleName, Optional.ofNullable(revision), semVer);
}
/**
* Creates new YANG Schema semVer source identifier.
*
- * @param moduleName
- * Name of schema
- * @param revision
- * Optional of source revision in format YYYY-mm-dd. If not
- * present, default value will be used.
- * @param semVer
- * semantic version of source
+ * @param moduleName Name of schema
+ * @param revision Optional of source revision in format YYYY-mm-dd. If not present, default value will be used.
+ * @param semVer semantic version of source
*/
- public static SemVerSourceIdentifier create(final String moduleName, final Optional<Revision> revision,
+ public static @NonNull SemVerSourceIdentifier create(final String moduleName, final Optional<Revision> revision,
final SemVer semVer) {
return new SemVerSourceIdentifier(moduleName, revision, semVer);
}
import com.google.common.collect.Interner;
import com.google.common.collect.Interners;
import java.util.Optional;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.concepts.Identifier;
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.yang.common.Revision;
private static final Interner<SourceIdentifier> INTERNER = Interners.newWeakInterner();
private static final long serialVersionUID = 2L;
- private final Revision revision;
- private final String name;
+ private final @Nullable Revision revision;
+ private final @NonNull String name;
/**
* Creates new YANG Schema source identifier for sources without revision.
*
- * @param name
- * Name of schema
+ * @param name Name of schema
*/
SourceIdentifier(final String name) {
this(name, (Revision) null);
/**
* Creates new YANG Schema source identifier.
*
- * @param name
- * Name of schema
- * @param revision
- * Revision of source, may be null
+ * @param name Name of schema
+ * @param revision Revision of source, may be null
*/
- SourceIdentifier(final String name, @Nullable final Revision revision) {
+ SourceIdentifier(final String name, final @Nullable Revision revision) {
this.name = requireNonNull(name);
this.revision = revision;
}
/**
* Creates new YANG Schema source identifier.
*
- * @param name
- * Name of schema
- * @param revision
- * Revision of source, possibly not present
+ * @param name Name of schema
+ * @param revision Revision of source, possibly not present
*/
SourceIdentifier(final String name, final Optional<Revision> revision) {
this(name, revision.orElse(null));
*
* @return Interned reference, or this object if it was interned.
*/
- public SourceIdentifier intern() {
+ public @NonNull SourceIdentifier intern() {
return INTERNER.intern(this);
}
*
* @return model name
*/
- public String getName() {
+ public @NonNull String getName() {
return name;
}
* Returns filename for this YANG module as specified in RFC 6020.
*
* <p>
- * Returns filename in format <code>name ['@' revision] '.yang'</code>,
- * where revision is date in format YYYY-mm-dd.
+ * Returns filename in format <code>name ['@' revision] '.yang'</code>, where revision is date in format YYYY-mm-dd.
*
* <p>
* @see <a href="http://tools.ietf.org/html/rfc6020#section-5.2">RFC6020</a>
*
* @return Filename for this source identifier.
*/
- public String toYangFilename() {
+ public @NonNull String toYangFilename() {
return toYangFileName(name, Optional.ofNullable(revision));
}
*
* @return Filename for this source identifier.
*/
- public static String toYangFileName(final String moduleName, final Optional<Revision> revision) {
+ public static @NonNull String toYangFileName(final String moduleName, final Optional<Revision> revision) {
StringBuilder filename = new StringBuilder(moduleName);
if (revision.isPresent()) {
filename.append('@');