I create my enumerations through reflection , for this I add to each enumeration an inner class that implements an abstract factory . Now I want to access this inner class to call the method:
@Factory(FooFactory.class)
public enum Foo {
FOO, BAR;
public class FooFactory implements AbstractFactory<Foo> {
public Foo create(String value) {
return valueOf(value.toUpperCase());
}
}
}
Definition @Factory:
@Retention(RetentionPolicy.RUNTIME)
public @interface Factory {
Class<?> value();
}
In doing so, however, I get the following error :
Class cannot be resolved for type FooFactory.java
When I try @Factory(Foo$FooFactory.class), I get an error :
Nested Foo $ FooFactory cannot be assigned using its binary name.
So is it possible to refer to a nested class at all?
source
share