*/
package org.opendaylight.yangtools.yang.model.api.stmt;
+import com.google.common.annotations.Beta;
+import javax.annotation.Nonnull;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
*/
public interface TypedefEffectiveStatement extends EffectiveStatement<QName, TypedefStatement>, TypeDefinitionAware {
+ /**
+ * Return this type definition as an effective type statement.
+ *
+ * @return Effective type statement.
+ */
+ @Beta
+ @Nonnull TypeEffectiveStatement<TypeStatement> asTypeEffectiveStatement();
}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.type;
-import com.google.common.base.Verify;
import com.google.common.collect.ImmutableMap;
import java.util.Collection;
import java.util.Map;
import org.opendaylight.yangtools.yang.model.api.type.Uint8TypeDefinition;
import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
import org.opendaylight.yangtools.yang.model.util.type.RestrictedTypes;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.typedef.TypedefEffectiveStatementImpl;
import org.opendaylight.yangtools.yang.parser.spi.TypeNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
final StmtContext<?, TypedefStatement, TypedefEffectiveStatement> typedef =
SourceException.throwIfNull(ctx.getFromNamespace(TypeNamespace.class, qname),
ctx.getStatementSourceReference(), "Type '%s' not found", qname);
-
- final TypedefEffectiveStatement effectiveTypedef = typedef.buildEffective();
- Verify.verify(effectiveTypedef instanceof TypedefEffectiveStatementImpl);
- typeStmt = ((TypedefEffectiveStatementImpl) effectiveTypedef).asTypeEffectiveStatement();
+ typeStmt = typedef.buildEffective().asTypeEffectiveStatement();
}
if (ctx.declaredSubstatements().isEmpty() && ctx.effectiveSubstatements().isEmpty()) {
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-// FIXME: hide this class
-public final class TypedefEffectiveStatementImpl extends AbstractEffectiveSchemaNode<TypedefStatement> implements
+final class TypedefEffectiveStatementImpl extends AbstractEffectiveSchemaNode<TypedefStatement> implements
TypedefEffectiveStatement {
private static final Logger LOG = LoggerFactory.getLogger(TypedefEffectiveStatementImpl.class);
return typeDefinition;
}
+ @Override
public TypeEffectiveStatement<TypeStatement> asTypeEffectiveStatement() {
TypeEffectiveStatement<TypeStatement> ret = typeStatement;
if (ret == null) {