private static Iterable < BoxUser . Info > getUsersInfoForType ( final BoxAPIConnection api , final String filterTerm , final String userType , final String externalAppUserId , final String ... fields ) { return new Iterable < BoxUser . Info > ( ) { public Iterator < BoxUser . Info > iterator ( ) { QueryStringBuilder builder = new QueryStringBuilder ( ) ; if ( filterTerm != null ) { builder . appendParam ( "filter_term" , filterTerm ) ; } if ( userType != null ) { builder . appendParam ( "user_type" , userType ) ; } if ( externalAppUserId != null ) { builder . appendParam ( "external_app_user_id" , externalAppUserId ) ; } if ( fields . length > 0 ) { builder . appendParam ( "fields" , fields ) ; } URL url = USERS_URL_TEMPLATE . buildWithQuery ( api . getBaseURL ( ) , builder . toString ( ) ) ; return new BoxUserIterator ( api , url ) ; } } ; }
Helper method to abstract out the common logic from the various users methods .