public CommandOption < T > defaultsTo ( Object aDefault ) { if ( aDefault == null ) { defaultValue = null ; return this ; } boolean isCorrectType ; if ( type instanceof ParameterizedType ) { isCorrectType = ( ( Class ) ( ( ParameterizedType ) type ) . getRawType ( ) ) . isInstance ( aDefault ) ; } else { isCorrectType = ( ( Class ) type ) . isInstance ( aDefault ) ; } if ( ! isCorrectType ) { throw new IllegalArgumentException ( "Expected default setting of type: " + type . getTypeName ( ) + ", but was provided: " + aDefault . getClass ( ) . getName ( ) ) ; } defaultValue = ( T ) aDefault ; return this ; }
Sets command option default value