|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
Collection.class
or Map.class
as parameter types.
Annotate return values:
@Contains(Parameter.class) public Collection<Parameter> myMethod();Annotate parameter types:
public void myMethod( @Contains(Parameter.class) Collection<Parameter> p );For practical reasons, only one level of content declaration is supported.
not supported: Map<String,Collection<Stmt>> myMethod();If you want to pass, for example a Map of Collections of type
Stmt
then you have to define a new type ecapsulating Collections of Stmt
.
Advantage: Design of overly nested generic types is prevented. Conversion operations are tied to
a concete type and make conversions more transparent.
rewrite it to: class Statements extends List<Stmt> implements Convertable<Collection<Stmt>> { ... } @Contains(Statements.class) Map<String,Statements> myMethod();
@Inherited @Documented @Retention(value=RUNTIME) @Target(value={PARAMETER,METHOD}) public @interface Contains
Required Element Summary | |
---|---|
java.lang.Class<?> |
value
Deprecated. |
Element Detail |
---|
public abstract java.lang.Class<?> value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |