Java Reference
In-Depth Information
Supposeyoudecidetoreplace
Stub
's
id()
,
dueDate()
,and
developer()
ele-
ments with a single
String value()
element whose string specifies comma-sep-
arated ID, due date, and developer name values.
Listing 3-45
shows you two ways to
initialize
value
.
Listing 3-45.
Initializing each
Stub
instance's
value()
element
public class Deck
{
@Stub(value = "1,12/21/2012,unassigned")
public void shuffle()
{
}
@Stub("2,12/21/2012,unassigned")
public Card[] deal(int cards)
{
return null;
}
}
notationtype'sonlyelement,youcanomit
value()
'snameand
=
fromtheinitializer.I
Using Meta-Annotations in Annotation Type Declarations
Eachofthe
Override
,
Deprecated
,and
SuppressWarnings
annotationtypes
is itself annotated with meta-annotations (annotations that annotate annotation types).
is annotated with two meta-annotations.
Listing 3-46.
The annotated
SuppressWarnings
type declaration
@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR,
LOCAL_VARIABLE})
@Retention(RetentionPolicy.SOURCE)
public @interface SuppressWarnings