Hi, I am trying to validate data from classes which are in inheritance relation. For example i have these two classes:
class Apple { ... private String color; .... //get , set }
and than:
class MyApple extends Apple { ... }
I am trying to validate the "color" of the apple in MyApple class without to create a instance of Apple class. Something like MyApple a=new MyApple(..,"green",..); Right now my constraints xml file have something like: <bean class="test.Apple" ignore-annotations="false"> <getter name="Color"> <constraint annotation="javax.validation.constraints.Size"> <element name="min">1</element> <element name="max">20</element> </constraint> </getter> ... </bean>
and: <bean class="test.MyApple" ignore-annotations="false"> ... <!-- no validation for color --> </bean> Problem is that trying in this way the validation is not working... for "MyApple" , i am missing some annotations in xml constraints file ? (something to tell which class inherits from which) , is it possible to handle this inheritance in this way ?
Please if you have an idea or a sugestion give me an hand !
Thanks
|