protected IFormalParameterBuilder [ ] createFormalParametersWith ( ParameterBuilder parameterBuilder , IMethod operation ) throws JavaModelException , IllegalArgumentException { final boolean isVarargs = Flags . isVarargs ( operation . getFlags ( ) ) ; final ILocalVariable [ ] rawParameters = operation . getParameters ( ) ; final FormalParameterProvider parameters = getFormalParameterProvider ( operation ) ; final int len = parameters . getFormalParameterCount ( ) ; final IFormalParameterBuilder [ ] paramBuilders = new IFormalParameterBuilder [ len ] ; for ( int i = 0 ; i < len ; ++ i ) { final ILocalVariable rawParameter = rawParameters [ i ] ; final IAnnotation annotation = getAnnotation ( rawParameter , DefaultValue . class . getName ( ) ) ; final String defaultValue = ( annotation != null ) ? extractDefaultValue ( operation , annotation ) : null ; final boolean isV = isVarargs && i == len - 1 ; String type = parameters . getFormalParameterType ( i , isV ) ; if ( isV && type . endsWith ( "[]" ) ) { //$NON-NLS-1$ type = type . substring ( 0 , type . length ( ) - 2 ) ; } final IFormalParameterBuilder sarlParameter = parameterBuilder . addParameter ( parameters . getFormalParameterName ( i ) ) ; sarlParameter . setParameterType ( type ) ; if ( defaultValue != null ) { sarlParameter . getDefaultValue ( ) . setExpression ( defaultValue ) ; } if ( isV ) { sarlParameter . setVarArg ( true ) ; } paramBuilders [ i ] = sarlParameter ; } return paramBuilders ; }
Create the formal parameters for the given operation .