我希望子类将特定的枚举值传递给父类extends
,以便这些特定的枚举值将在某些注释中的父类中使用。以下是我真正想要实现的目标。
public enum SomeEnum {
VAL1, VAL2;
}
public @interface SomeAnnotation {
SomeEnum someValue();
}
//below starts all fuzzy things : I want a specific value of enum
public class parent<FetchType> {// not sure what exactly should write between < >
// below,at someValue I want the specific enum passed by child , means
// the value passed between < and >
@SomeAnnotation(someValue = null /* here should be the specific enum value passed
as type parameter of this class */)
private String someString;
//getter-setter
}
//as i said , for child1 , i need SomeEnum.VAL1 to be passed to parent and
// SomeEnum.VAL2 for child2.
public class child1 extends parent<SomeEnum.VAL1>{}
public class child2 extends parent<SomeEnum.VAL2>{}