simplify getOpType by using Enum's static function valueOf

simplify getOpType in WriteType and ReadType by using Enum's static function valueOf
Catching `RuntimeException` is not safe.  Please catch `IllegalArgumentException` which is the exception thrown by `valueOf`.