in documentations, it says the following;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@qualifier
@retention(RUNTIME)
@target({TYPE, METHOD, FIELD, PARAMETER})
public @interface Informal {}
You can then define a bean class that extends the Greeting class and uses this qualifier:
package greetings;
@InFormal
public class InformalGreeting extends Greeting {
public String greet(String name) {
return "Hi, " + name + "!";
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
However in the examples the book provide, the following annotations are used.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@qualifier
@retention(RUNTIME)
@target({FIELD, TYPE, METHOD})
public @interface ThirteenDigits {
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
In netbeans IDE, this gives an error (http://tinypic.com/view.php?pic=fknqs2&s=8#.U5R4Z3VdWhc), although it compiles and runs.
I tried changing the the target annotation to @target({METHOD, FIELD, PARAMETER, TYPE}), which works just as well without the error sign. Are there going to be cases where I'd want(because of necessity) to put 3 targets likeyou did, instead of 4 like documentation suggests?
in documentations, it says the following;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@qualifier
@retention(RUNTIME)
@target({TYPE, METHOD, FIELD, PARAMETER})
public @interface Informal {}
You can then define a bean class that extends the Greeting class and uses this qualifier:
package greetings;
@InFormal
public class InformalGreeting extends Greeting {
public String greet(String name) {
return "Hi, " + name + "!";
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
However in the examples the book provide, the following annotations are used.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@qualifier
@retention(RUNTIME)
@target({FIELD, TYPE, METHOD})
public @interface ThirteenDigits {
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
In netbeans IDE, this gives an error (http://tinypic.com/view.php?pic=fknqs2&s=8#.U5R4Z3VdWhc), although it compiles and runs.
I tried changing the the target annotation to @target({METHOD, FIELD, PARAMETER, TYPE}), which works just as well without the error sign. Are there going to be cases where I'd want(because of necessity) to put 3 targets likeyou did, instead of 4 like documentation suggests?