1 package test4; 2 3 import java.util.ArrayList; 4 5 public class JIRA181<T extends Number> extends ArrayList<T> { 6 /** default serialVersionUID */ 7 private static final long serialVersionUID = 1L; 8 9 public @interface Condition { condition()10 Class<? extends ICondition> condition(); 11 } 12 13 public @interface Condition2 { condition()14 Class<?> condition(); 15 } 16 17 @Condition(condition = B.class) 18 public Object aField; 19 20 @Condition2(condition = B[].class) 21 public Object aField2; 22 23 public interface ICondition { match(Object src)24 boolean match(Object src); 25 } 26 27 private class B implements ICondition { match(Object src)28 public boolean match(Object src) { 29 return JIRA181.this.size() > 0; 30 } 31 } 32 } 33