de.dfki.util.xmlrpc.annotation
Annotation Type Contains


Deprecated. Declares content of collections and maps which occur in method parameters and return values. We need this because of Java's type erasure mechanism deletes information on the parameterized generics leaving only e.g., 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

value

public abstract java.lang.Class<?> value
Deprecated. 


Copyright © 2012. All Rights Reserved.