class P2PathUtils {

  public static String maybePath(final TokenMatcher.State state) {
    checkNotNull(state);
    String path = state.getTokens().get("path");
    if (isNullOrEmpty(path)) {
      return String.format("%s.%s", match(state, "name"), match(state, "extension"));
    }
    return String.format("%s/%s.%s", path, match(state, "name"), match(state, "extension"));
  }

  private  P2PathUtils();

}