Example usage for com.liferay.portal.kernel.util StringParser build

List of usage examples for com.liferay.portal.kernel.util StringParser build

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringParser build.

Prototype

public String build(Map<String, String> parameters) 

Source Link

Document

Builds a string from the parameter map if this parser is appropriate.

Usage

From source file:com.liferay.portlet.RouteImpl.java

License:Open Source License

public boolean urlToParameters(String url, Map<String, String> parameters) {
    if (!_stringParser.parse(url, parameters)) {
        return false;
    }//from   w  w  w  . j  a va  2s . com

    parameters.putAll(_implicitParameters);
    parameters.putAll(_overriddenParameters);

    // The order is important because generated parameters may be dependent
    // on implicit parameters or overridden parameters

    for (Map.Entry<String, StringParser> entry : _generatedParameters.entrySet()) {

        String name = entry.getKey();
        StringParser stringParser = entry.getValue();

        String value = stringParser.build(parameters);

        // Generated parameters are not guaranteed to be created. The format
        // of the virtual parameters in the route pattern must match their
        // format in the generated parameter.

        if (value != null) {
            parameters.put(name, value);
        }
    }

    return true;
}