mercredi 8 avril 2015

ENUM validation spring expression language

I am trying to validate a json field which internally is mapped to ENUM businessType internally in service. I am unable to write logic in SpEL to assert that business_type json field is one of the businessType Enums


I tried using instanceof but it only validates if input is an 'instance of' BusinessDetails class, not that if it is one of the ENUMS in BusinessDetails.BusinessType


<property name="isValid" value="(#element.businessType instanceof (com.paypal.platform.ops.model.BusinessDetails$BusinessType))" />


Please suggest how can i validate the input to be one of the defined ENUM types. Thanks for your input!


Aucun commentaire:

Enregistrer un commentaire