how to handle dealing with casting alternative in javawatir