title: How to accept multiple types in Java annotation parameter?
body: <p>I would like to use an annotation on a key string to configure the initial value for a property of that key.  E.g.,</p>
  
  <pre><code>@NodeProperty(initialValue = "bar") static final String "FOO";
  </code></pre>
  
  <p>Other code later processes the annotation, adding a key "FOO" with value "bar" to a particular key-value store, if key "FOO" doesn't already exist.</p>
  
  <p>My annotation declaration is:</p>
  
  <pre><code>@Retention(RetentionPolicy.RUNTIME)
  @interface NodeProperty {
      long initialValue();  // I want to accept Strings, ints, byte[], etc. here.
  }
  </code></pre>
  
  <p>But, I don't know the type of <code>initialValue</code> ahead of time.  I'd like to accept all primitives, Strings, and arrays of the these.</p>
  
  <p>Any ideas on how to accomplish this?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Unfortunately, it sounds like overloading the annotation parameter isn't currently possible.  The answers below contain various workarounds.</p>