Example usage for org.eclipse.jgit.util StringUtils toBooleanOrNull

List of usage examples for org.eclipse.jgit.util StringUtils toBooleanOrNull

Introduction

In this page you can find the example usage for org.eclipse.jgit.util StringUtils toBooleanOrNull.

Prototype

public static Boolean toBooleanOrNull(String stringValue) 

Source Link

Document

Parse a string as a standard Git boolean value.

Usage

From source file:com.google.gitiles.doc.MarkdownConfig.java

License:Apache License

MarkdownConfig(Config cfg) {
    render = cfg.getBoolean("markdown", "render", true);
    inputLimit = cfg.getInt("markdown", "inputLimit", 5 << 20);
    imageLimit = cfg.getInt("markdown", "imageLimit", IMAGE_LIMIT);
    analyticsId = Strings.emptyToNull(cfg.getString("google", null, "analyticsId"));

    String[] f = cfg.getStringList("markdown", null, "allowiframe");
    allowAnyIFrame = f.length == 1 && StringUtils.toBooleanOrNull(f[0]) == Boolean.TRUE;
    if (allowAnyIFrame) {
        allowIFrame = ImmutableList.of();
    } else {//from  w w  w . ja  v  a2s.  com
        allowIFrame = ImmutableList.copyOf(f);
    }
}

From source file:com.google.gitiles.doc.MarkdownToHtml.java

License:Open Source License

private boolean canRender(IframeNode node) {
    String[] ok = cfg.getStringList("markdown", null, "allowiframe");
    if (ok.length == 1 && StringUtils.toBooleanOrNull(ok[0]) == Boolean.TRUE) {
        return true;
    }/*from  www  .  j  a v a  2  s .co m*/
    for (String m : ok) {
        if (m.equals(node.src) || (m.endsWith("/") && node.src.startsWith(m))) {
            return true;
        }
    }
    return false; // By default do not render iframe.
}