Example usage for com.mongodb MongoClientURI getURI

List of usage examples for com.mongodb MongoClientURI getURI

Introduction

In this page you can find the example usage for com.mongodb MongoClientURI getURI.

Prototype

public String getURI() 

Source Link

Document

Get the unparsed URI.

Usage

From source file:org.netbeans.modules.mongodb.ui.components.MongoURIEditorPanel.java

License:Open Source License

private List<Option> decodeOptions(MongoClientURI uri) {
    final List<Option> options = new ArrayList<>();
    final String uriString = uri.getURI();
    final int index = uriString.indexOf('?');
    if (index != -1) {
        final String optionsPart = uriString.substring(index + 1);
        for (String option : optionsPart.split("&|;")) {
            int idx = option.indexOf("=");
            if (idx >= 0) {
                final String key = option.substring(0, idx);
                final String value = option.substring(idx + 1);
                options.add(new Option(key, value));
            }//from   w ww  .  ja v  a  2 s  .  c  om
        }
    }
    return options;
}