use of org.apache.wicket.model.ChainingModel in project webanno by webanno.
the class ModelChangedVisitor method innermostModel.
private IModel<?> innermostModel(IModel<?> aModel) {
IModel<?> nested = aModel;
while (nested != null) {
if (nested instanceof IWrapModel) {
final IModel<?> next = ((IWrapModel<?>) nested).getWrappedModel();
if (nested == next) {
throw new WicketRuntimeException("Model for " + nested + " is self-referential");
}
nested = next;
} else if (nested instanceof ChainingModel) {
final IModel<?> next = ((ChainingModel<?>) nested).getChainedModel();
if (nested == next) {
throw new WicketRuntimeException("Model for " + nested + " is self-referential");
}
nested = next;
} else {
break;
}
}
return nested;
}
Aggregations