Can we have generics here so that implementers do not need to do unchecked casts?