Example usage for org.eclipse.jgit.attributes Attribute getKey

List of usage examples for org.eclipse.jgit.attributes Attribute getKey

Introduction

In this page you can find the example usage for org.eclipse.jgit.attributes Attribute getKey.

Prototype

public String getKey() 

Source Link

Document

Get key

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   www  .  java 2s .  co  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;
}