static String tokenize(PageMetadata<?, ?> pageMetadata) {
        try {
            Gson g = getGsonWithKeyAdapter(pageMetadata.pageRequestParameters);
            return new String(Base64.encodeBase64URLSafe(g.toJson(new PaginationToken
                    (pageMetadata)).getBytes("UTF-8")),
                    Charset.forName("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            //all JVMs should support UTF-8
            throw new RuntimeException(e);
        }
    }
static String tokenize ( PageMetadata < ? , ? > pageMetadata ) { try { Gson g = getGsonWithKeyAdapter ( pageMetadata . pageRequestParameters ) ; return new String ( Base64 . encodeBase64URLSafe ( g . toJson ( new PaginationToken ( pageMetadata ) ) . getBytes ( "UTF-8" ) ) , Charset . forName ( "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } }
Generate an opaque pagination token from the supplied PageMetadata.

@param pageMetadata page metadata of the page for which the token should be generated
@return opaque pagination token