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

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

Introduction

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

Prototype

public List<Attribute> getAttributes() 

Source Link

Document

Return the attributes.

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 w  w  w  .  j a  v  a  2  s . 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  v a 2 s.  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;
}