/**
* Get identities derived from a selected identity.
*
+ * @param identity base identity
* @return collection of identities derived from this identity
* @throws NullPointerException if identity is null
* @throws IllegalArgumentException if the specified identity is not present in this context
* Returns collection of explicitly declared child statements, while preserving its original ordering from original
* source.
*
+ * @param <T> substatement type
* @param type {@link DeclaredStatement} type
* @return Collection of statements, which were explicitly declared in source of model.
* @throws NullPointerException if {@code type} is null
*/
- default <S extends DeclaredStatement<?>> @NonNull Collection<? extends S> declaredSubstatements(
- final Class<S> type) {
+ default <T extends DeclaredStatement<?>> @NonNull Collection<? extends T> declaredSubstatements(
+ final Class<T> type) {
requireNonNull(type);
return Collections2.transform(Collections2.filter(declaredSubstatements(), type::isInstance), type::cast);
}
/**
* Find the first effective substatement of specified type.
*
+ * @param <T> substatement type
* @param type {@link DeclaredStatement} type
* @return First declared substatement, or empty if no match is found.
* @throws NullPointerException if {@code type} is null
/**
* Find the first declared substatement of specified type and return its value.
*
+ * @param <T> substatement type
+ * @param <V> substatement argument type
+ * @param type {@link DeclaredStatement} type
* @return First declared substatement's argument, or empty if no match is found.
* @throws NullPointerException if {@code type} is null
*/
/**
* Find all declared substatements of specified type and return them as a stream.
*
+ * @param <T> substatement type
+ * @param type {@link DeclaredStatement} type
* @return A stream of all declared substatements of specified type.
* @throws NullPointerException if {@code type} is null
*/
/**
* Find the first effective substatement of specified type.
*
+ * @param <T> substatement type
+ * @param type substatement type
* @return First effective substatement, or empty if no match is found.
*/
@Beta
/**
* Find the first effective substatement of specified type and return its value.
*
+ * @param <T> substatement type
+ * @param <V> substatement argument type
+ * @param type substatement type
* @return First effective substatement's argument, or empty if no match is found.
*/
@Beta
/**
* Find all effective substatements of specified type and return them as a stream.
*
+ * @param <T> substatement type
+ * @param type substatement type
* @return A stream of all effective substatements of specified type.
*/
@Beta
/**
* Find a {@code data tree} child {@link DataTreeEffectiveStatement}, as identified by its QName argument.
*
+ * @param <E> Effective substatement type
* @param qname Child identifier
* @return Data tree child, or empty
* @throws NullPointerException if {@code qname} is null
/**
* Find a {@code schema tree} child {@link SchemaTreeEffectiveStatement}, as identified by its QName argument.
*
+ * @param <E> Effective substatement type
* @param qname Child identifier
* @return Schema tree child, or empty
* @throws NullPointerException if {@code qname} is null
*
* @param moduleName Name of schema
* @param revision Revision of source in format YYYY-mm-dd. If not present, default value will be used.
+ * @return A RevisionSourceIdentifier
*/
public static @NonNull RevisionSourceIdentifier create(final String moduleName, final Optional<Revision> revision) {
return new RevisionSourceIdentifier(moduleName, revision);
*
* @param moduleName Name of schema
* @param revision Revision of source, may be null
+ * @return A RevisionSourceIdentifier
*/
public static @NonNull RevisionSourceIdentifier create(final String moduleName, final @Nullable Revision revision) {
return new RevisionSourceIdentifier(moduleName, revision);
* Creates new YANG Schema revision source identifier for sources without
* a revision.
*
- * @param moduleName
- * Name of schema
+ * @param moduleName Name of schema
+ * @return A RevisionSourceIdentifier
*/
public static @NonNull RevisionSourceIdentifier create(final String moduleName) {
return new RevisionSourceIdentifier(moduleName);
*
* @param moduleName Name of schema
* @param semVer semantic version of source
+ * @return A SemVerSourceIdentifier
*/
public static @NonNull SemVerSourceIdentifier create(final String moduleName, final SemVer semVer) {
return new SemVerSourceIdentifier(moduleName, semVer);
* @param moduleName Name of schema
* @param revision Revision of source in format YYYY-mm-dd
* @param semVer semantic version of source
+ * @return A SemVerSourceIdentifier
*/
public static @NonNull SemVerSourceIdentifier create(final String moduleName, final Revision revision,
final SemVer semVer) {
* @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
+ * @return A SemVerSourceIdentifier
*/
public static @NonNull SemVerSourceIdentifier create(final String moduleName, final Optional<Revision> revision,
final SemVer semVer) {
* <p>
* See http://tools.ietf.org/html/rfc6020#section-5.2
*
+ * @param moduleName module name
+ * @param revision optional revision
* @return Filename for this source identifier.
*/
public static @NonNull String toYangFileName(final String moduleName, final Optional<Revision> revision) {
- StringBuilder filename = new StringBuilder(moduleName);
+ final StringBuilder sb = new StringBuilder(moduleName);
if (revision.isPresent()) {
- filename.append('@');
- filename.append(revision.get());
+ sb.append('@').append(revision.orElseThrow());
}
- filename.append(YangConstants.RFC6020_YANG_FILE_EXTENSION);
- return filename.toString();
+ return sb.append(YangConstants.RFC6020_YANG_FILE_EXTENSION).toString();
}
}
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
/**
- * Registry of all potentially available schema sources. Processes capable of
- * dynamic schema discovery, such as OSGi registry scanners, NETCONF clients
- * (with NETCONF monitoring extension) and similar can register
- * {@link SchemaSourceProvider} instances which would then acquire the schema
- * source.
+ * Registry of all potentially available schema sources. Processes capable of dynamic schema discovery, such as OSGi
+ * registry scanners, NETCONF clients (with NETCONF monitoring extension) and similar can register
+ * {@link SchemaSourceProvider} instances which would then acquire the schema source.
*/
@Beta
public interface SchemaSourceRegistry {
/**
- * Register a new schema source which is potentially available from a provider.
- * A registration does not guarantee that a subsequent call to
- * {@link SchemaSourceProvider#getSource(SourceIdentifier)} will succeed.
+ * Register a new schema source which is potentially available from a provider. A registration does not guarantee
+ * that a subsequent call to {@link SchemaSourceProvider#getSource(SourceIdentifier)} will succeed.
*
+ * @param <T> schema source representation type
* @param provider Resolver which can potentially resolve the identifier
* @param source Schema source details
- * @return A registration handle. Invoking {@link SchemaSourceRegistration#close()}
- * will cancel the registration.
+ * @return A registration handle. Invoking {@link SchemaSourceRegistration#close()} will cancel the registration.
*/
<T extends SchemaSourceRepresentation> SchemaSourceRegistration<T> registerSchemaSource(
SchemaSourceProvider<? super T> provider, PotentialSchemaSource<T> source);
/**
- * Register a schema source listener. The listener will be notified as new
- * sources and their representations become available, subject to the provided
- * filter.
+ * Register a schema source listener. The listener will be notified as new sources and their representations become
+ * available, subject to the provided filter.
*
* @param listener Schema source listener
- * @return A registration handle. Invoking {@link SchemaListenerRegistration#close()}
- * will cancel the registration.
+ * @return A registration handle. Invoking {@link SchemaListenerRegistration#close()} will cancel the registration.
*/
SchemaListenerRegistration registerSchemaSourceListener(SchemaSourceListener listener);
}