Why not use getTupleStorageSize()/getObjectLength() so that you only need an if/else block instead of writing the switch case?