implement type-specific methods to centralize casting