switch class ensure pattern