private static Single<Optional<AccessToken>> forToken(String tokenString) {
        return SingleRxXian
                .call("OAuth", "validateAccessToken", new JSONObject().fluentPut("access_token", tokenString))
                .map(response -> {
                    if (!response.succeeded()) {
                        //wrong token or expired token
                        return Optional.empty();
                    }
                    return Optional.of(response.dataToType(AccessToken.class));
                });
    }
private static Single < Optional < AccessToken > > forToken ( String tokenString ) { return SingleRxXian . call ( "OAuth" , "validateAccessToken" , new JSONObject ( ) . fluentPut ( "access_token" , tokenString ) ) . map ( response -> { if ( ! response . succeeded ( ) ) { return Optional . empty ( ) ; } return Optional . of ( response . dataToType ( AccessToken . class ) ) ; } ) ; }
@param tokenString the token string
@return the access token or empty if token is wrong or expired.