private void initTypeParameterBindings ( ) { // // Get an iterator to both the declared type arguments and the original type // declaration on the associated control interface // DeclaredType fieldType = ( DeclaredType ) _fieldDecl . getType ( ) ; Iterator < TypeMirror > paramBoundIter = fieldType . getActualTypeArguments ( ) . iterator ( ) ; TypeDeclaration intfDecl = ( TypeDeclaration ) _controlIntf . getTypeDeclaration ( ) ; Iterator < TypeParameterDeclaration > paramDeclIter = intfDecl . getFormalTypeParameters ( ) . iterator ( ) ; // // Iterate through them in parallel, creating a mapping from the original formal // type parameter name to the actual bound type. In parallel, also build up a // representation of the bound type declaration. // // NOTE: If no type binding is done on the field declaration, then loop below // will not execute and no mappings/empty bound decl will be the result. // StringBuffer sb = new StringBuffer ( ) ; boolean isFirst = true ; while ( paramBoundIter . hasNext ( ) ) { TypeMirror paramBound = paramBoundIter . next ( ) ; TypeParameterDeclaration paramDecl = paramDeclIter . next ( ) ; // // Save a mapping from the formal type name to the bound mirror type // _typeBindingMap . put ( paramDecl . getSimpleName ( ) , paramBound ) ; if ( isFirst ) { sb . append ( "<" ) ; isFirst = false ; } else sb . append ( ", " ) ; sb . append ( paramBound ) ; } if ( ! isFirst ) sb . append ( ">" ) ; _boundParameterDecl = sb . toString ( ) ; }
Computes the binding from any formal type parameters declared on the control interface to bound types on the field declaration .