Bug 2366 - Effective statments impl merge, retest & bugfix
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / effective / EffectiveStmtUtils.java
1 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
2
3 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
4
5 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
6 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
7
8 public class EffectiveStmtUtils {
9
10     private EffectiveStmtUtils(){
11         throw new UnsupportedOperationException("Utility class");
12     }
13
14     public static final SourceException createNameCollisionSourceException(
15             final StmtContext<?, ?, ?> ctx,
16             EffectiveStatement<?, ?> effectiveStatement) {
17         return new SourceException("Error in module '"
18                 + ctx.getRoot().getStatementArgument()
19                 + "': can not add '"
20                 + effectiveStatement.argument()
21                 + "'. Node name collision: '"
22                 + effectiveStatement.argument()
23                 + "' already declared.",
24                 ctx.getStatementSourceReference());
25     }
26
27 }