public static CreateOptions getOpt ( Class < ? extends CreateOptions > theClass , CreateOptions ... opts ) { if ( opts == null ) return null ; CreateOptions result = null ; for ( int i = 0 ; i < opts . length ; ++ i ) { if ( opts [ i ] . getClass ( ) == theClass ) { if ( result != null ) throw new IllegalArgumentException ( "Multiple args with type " + theClass ) ; result = opts [ i ] ; } } return result ; }
Get an option of desired type