refactor rule metadata in java backend to use typed attributes

@yilongli please review