private void copySubstatement(final Mutable<?, ?, ?> stmtContext, final Mutable<?, ?, ?> target, final CopyType typeOfCopy, final QNameModule newQNameModule, final Collection<Mutable<?, ?, ?>> buffer) { if (needToCopyByUses(stmtContext)) { final Mutable<?, ?, ?> copy = target.childCopyOf(stmtContext, typeOfCopy, newQNameModule); LOG.debug("Copying substatement {} for {} as {}", stmtContext, this, copy); buffer.add(copy); } else if (isReusedByUses(stmtContext)) { LOG.debug("Reusing substatement {} for {}", stmtContext, this); buffer.add(stmtContext); } else { LOG.debug("Skipping statement {}", stmtContext); } }
/** * Create a child sub-statement, which is a child of this statement, inheriting all attributes from specified * child and recording copy type. Resulting object may only be added as a child of this statement. * * @param stmt Statement to be used as a template * @param type Type of copy to record in history * @return copy of statement considering {@link CopyType} (augment, uses) * * @throws IllegalArgumentException if stmt cannot be copied into this statement, for example because it comes * from an alien implementation. * @throws org.opendaylight.yangtools.yang.parser.spi.source.SourceException instance of SourceException */ default <X, Y extends DeclaredStatement<X>, Z extends EffectiveStatement<X, Y>> Mutable<X, Y, Z> childCopyOf( final StmtContext<X, Y, Z> stmt, final CopyType type) { return childCopyOf(stmt, type, null); }