Annotation containing annotation with value

347
May 03, 2017, at 6:31 PM

My question is related to Java: Annotated Annotations (and passing values), but not entirely the same, so I thought I'd ask anyway. Especially since there were so few answers to that question.

Say I have written an annotation like this:

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface NestedAnnotation {
    public String value();
    public Class<?> impl() default Void.class;
}

So if I want to use this, I have to do something like @NestedAnnotation("somevalue"). Now, what if I want to put that annotation inside another one:

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@NestedAnnotation("need value here!")
public @interface OuterAnnotation {
    public String value();
    public Class<?> impl() default Void.class;
}

The NestedAnnotation needs a value, and adding a String (like above) works. But what if I wanted to pass on a value that was received by the OuterAnnotation? Is that possible?

Rent Charter Buses Company
READ ALSO
Uploading a File to Server Failed in Android using ion library

Uploading a File to Server Failed in Android using ion library

I am new in android ,and am trying to upload a file to server using ion library ion library but the file crasheswith this error

396
How to get text of a toaster message in mobile app using Appium

How to get text of a toaster message in mobile app using Appium

I am trying to verify a toaster message in Android Mobile app but not able to get text of toaster message as it doesn't show in uiautomatorviewerGot some information that by the help of OCR it can be done taking screenshots and fetching the text from that screenshots...

1044
How to set rmiregistry in bash script for JMX monitoring

How to set rmiregistry in bash script for JMX monitoring

I am trying to set the RMI registry for remote JMX monitoring and am trying to set the JMX parametersI have set the parameters under JAVA_OPTS and I need to create the RMI registry in the same script

488