title: How to initialize a class inside a Java annotation?
body: <p>We have a class which we need to pass into parameter of annotation but want to initialize it before passing</p>
  
  <pre><code>public final class StandardAnalyzer extends StopwordAnalyzerBase {
  
  public static final int DEFAULT_MAX_TOKEN_LENGTH = 255;
  private int maxTokenLength;
  private final boolean replaceInvalidAcronym;
  public static final Set&lt;?&gt; STOP_WORDS_SET;
  
  public StandardAnalyzer(Version matchVersion, Set&lt;?&gt; stopWords) {
  
  }
  </code></pre>
  
  <p>Following is annotation:</p>
  
  <pre><code> @Fields({ @Field(index = Index.YES, store = Store.NO, analyzer = @Analyzer(impl = StandardAnalyzer.class)
  </code></pre>
  
  <p>In @Analyzer(impl = StandardAnalyzer &lt;- I want to pass arguments i.e StandardAnalyzer(Version, stopwords) and i have tried using new but failed. </p>
  
  <p>Following is annotation details for Analyzer:</p>
  
  <pre><code>@Retention(value = RetentionPolicy.RUNTIME)
  @Target(value = {ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
  @Documented
  public @interface Analyzer {
    public Class&lt;?&gt; impl() default void.class; &lt;--- Here is where i want to pass
    public String definition() default "";
  }
  </code></pre>
  
  <p>Is there any way out to initialize class before passing in annotation?</p>