private static Option findTemplate ( String name , Option [ ] templates ) { boolean listAllowed = false ; Option listOption = null ; for ( int i = 0 ; i < templates . length ; i ++ ) { if ( templates [ i ] . getName ( ) . equals ( name ) ) { return templates [ i ] ; } if ( Type . LIST . equals ( templates [ i ] . getType ( ) ) ) { listAllowed = true ; listOption = templates [ i ] ; } } if ( listAllowed ) { return listOption ; } return null ; }
Searches an array of option templates and returns an option matching the supplied name or null if no match is found .