@ Pure @ SuppressWarnings ( { "checkstyle:cyclomaticcomplexity" , "checkstyle:npathcomplexity" } ) public static String [ ] getAllCommandLineParameters ( ) { final int osize = commandLineOptions == null ? 0 : commandLineOptions . size ( ) ; final int psize = commandLineParameters == null ? 0 : commandLineParameters . length ; final int tsize = ( osize > 0 && psize > 0 ) ? 1 : 0 ; final List < String > params = new ArrayList <> ( osize + tsize ) ; if ( osize > 0 ) { List < Object > values ; String name ; String prefix ; String v ; for ( final Entry < String , List < Object > > entry : commandLineOptions . entrySet ( ) ) { name = entry . getKey ( ) ; prefix = ( name . length ( ) > 1 ) ? "--" : "-" ; //$NON-NLS-1$ //$NON-NLS-2$ values = entry . getValue ( ) ; if ( values == null || values . isEmpty ( ) ) { params . add ( prefix + name ) ; } else { for ( final Object value : values ) { if ( value != null ) { v = value . toString ( ) ; if ( v != null && v . length ( ) > 0 ) { params . add ( prefix + name + "=" + v ) ; //$NON-NLS-1$ } else { params . add ( prefix + name ) ; } } } } } } if ( tsize > 0 ) { params . add ( "--" ) ; //$NON-NLS-1$ } final String [ ] tab = new String [ params . size ( ) + psize ] ; params . toArray ( tab ) ; params . clear ( ) ; if ( psize > 0 ) { System . arraycopy ( commandLineParameters , 0 , tab , osize + tsize , psize ) ; } return tab ; }
Replies the command line including the options and the standard parameters .