1 package com.atlassian.plugin.webresource;
2
3 import java.util.Map;
4
5 /**
6 * A formatter to format web resources into HTML.
7 * <p/>
8 * The {@link #matches(String)} method should be called before calling {@link #formatResource(String, Map)},
9 * to ensure correct formatting of the resource.
10 */
11 interface WebResourceFormatter
12 {
13 /**
14 * Returns a boolean indicating whether the WebResourceFormatter can support
15 * formatting of the resource.
16 * @param name name of the resource
17 * @return true if the formatter can format the resource, false otherwise.
18 */
19 boolean matches(String name);
20
21 /**
22 * Returns a formatted resource string.
23 * @param url url path to the resource
24 * @param parameters a {@link Map} of resource parameters
25 * @return a formatted resource {@link String}.
26 */
27 String formatResource(String url, Map<String, String> parameters);
28 }