Example usage for org.eclipse.jgit.attributes AttributesRule isMatch

List of usage examples for org.eclipse.jgit.attributes AttributesRule isMatch

Introduction

In this page you can find the example usage for org.eclipse.jgit.attributes AttributesRule isMatch.

Prototype

public boolean isMatch(String relativeTarget, boolean isDirectory) 

Source Link

Document

Returns true if a match was made.

Usage

From source file:com.diffplug.gradle.spotless.GitAttributesLineEndingPolicy.java

License:Apache License

/** Parses an attribute value from a list of rules, returning null if there is no match for the given key. */
static String findAttributeInRules(String subpath, boolean isFolder, String key, List<AttributesRule> rules) {
    String value = null;/*from ww w  .  j a  v a  2s  .c  o m*/
    // later rules override earlier ones
    for (AttributesRule rule : rules) {
        if (rule.isMatch(subpath, isFolder)) {
            for (Attribute attribute : rule.getAttributes()) {
                if (attribute.getKey().equals(key)) {
                    value = attribute.getValue();
                }
            }
        }
    }
    return value;
}

From source file:com.diffplug.spotless.extra.GitAttributesLineEndings.java

License:Apache License

/** Parses an attribute value from a list of rules, returning null if there is no match for the given key. */
private static @Nullable String findAttributeInRules(String subpath, boolean isFolder, String key,
        List<AttributesRule> rules) {
    String value = null;//from  w ww. j a  va 2s . c  om
    // later rules override earlier ones
    for (AttributesRule rule : rules) {
        if (rule.isMatch(subpath, isFolder)) {
            for (Attribute attribute : rule.getAttributes()) {
                if (attribute.getKey().equals(key)) {
                    value = attribute.getValue();
                }
            }
        }
    }
    return value;
}