private void checkEnum ( ThriftType expectedType , int i ) { if ( expectedType . getType ( ) == ThriftTypeID . ENUM ) { ThriftType . EnumType expectedEnumType = ( ThriftType . EnumType ) expectedType ; if ( expectedEnumType . getEnumValueById ( i ) == null ) { throw new DecodingSchemaMismatchException ( "can not find index " + i + " in enum " + expectedType ) ; } } }
In thrift enum values are written as ints this method checks if the enum index is defined .