use of org.opendaylight.yangtools.yang.model.api.TypeAware in project yangtools by opendaylight.
the class SchemaInferenceStack method resolveLeafref.
@Override
public TypeDefinition<?> resolveLeafref(final LeafrefTypeDefinition type) {
final SchemaInferenceStack tmp = copy();
LeafrefTypeDefinition current = type;
while (true) {
final EffectiveStatement<?, ?> resolved = tmp.resolvePathExpression(current.getPathStatement());
checkState(resolved instanceof TypeAware, "Unexpected result %s resultion of %s", resolved, type);
final TypeDefinition<?> result = ((TypedDataSchemaNode) resolved).getType();
if (result instanceof LeafrefTypeDefinition) {
checkArgument(result != type, "Resolution of %s loops back onto itself via %s", type, current);
current = (LeafrefTypeDefinition) result;
} else {
return result;
}
}
}
Aggregations