private String getNextToken()

in src/main/java/com/awslabs/resultsiterator/implementations/ResultsIteratorAbstract.java [210:232]


    private String getNextToken() {
        if (clientGetMethodReturningString == null) {
            // Look for a public method that takes no arguments and returns a string that matches our list of expected names.  If zero or more than one exists, fail.
            clientGetMethodReturningString = reflectionHelper.getMethodWithParameterReturnTypeAndNames(getResponseClass(), null, String.class, primaryTokenMethodNames);

            if (clientGetMethodReturningString.isEmpty()) {
                // Only look for the secondary method if the primary methods aren't there
                reflectionHelper.getMethodWithParameterReturnTypeAndNames(getResponseClass(), null, String.class, secondaryTokenMethodNames);
            }
        }

        if (clientGetMethodReturningString.isEmpty()) {
            // Some methods like S3's listBuckets do not have pagination
            return null;
        }

        try {
            return (String) clientGetMethodReturningString.get().invoke(awsResponse);
        } catch (IllegalAccessException | InvocationTargetException e) {
            e.printStackTrace();
            throw new UnsupportedOperationException(e);
        }
    }