org.gradle.api.provider.Provider.getOrNull()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中org.gradle.api.provider.Provider.getOrNull()方法的一些代码示例,展示了Provider.getOrNull()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Provider.getOrNull()方法的具体详情如下:
包路径:org.gradle.api.provider.Provider
类名称:Provider
方法名:getOrNull

Provider.getOrNull介绍

暂无

代码示例

代码示例来源:origin: org.gradle/gradle-core

@Override
public T getOrNull() {
  return provider.getOrNull();
}

代码示例来源:origin: org.gradle/gradle-core

@Override
  public T getOrNull() {
    T value = provider.getOrNull();
    if (value == null || type.isInstance(value)) {
      return value;
    }
    throw new IllegalArgumentException(String.format("Cannot get the value of a property of type %s as the provider associated with this property returned a value of type %s.", type.getName(), value.getClass().getName()));
  }
};

代码示例来源:origin: typelead/gradle-eta

@Override
public T getOrNull() {
  T val = overriding.getOrNull();
  if (val == null || considerEphemeral.test(val)) {
    return ephemeral.getOrNull();
  }
  return val;
}

代码示例来源:origin: gradle.plugin.mpern.sap.commerce/commerce-gradle-plugin

private String readVersion() {
    Directory orNull = platformDir.getOrNull();

    if (orNull == null) {
      return "NONE";
    }
    Path buildFile = orNull.file("build.number").getAsFile().toPath();
    Properties properties = new Properties();

    try (BufferedReader br = new BufferedReader(new FileReader(buildFile.toFile()))) {
      properties.load(br);
    } catch (IOException e) {
      LOG.debug("could not open build.number", e);
    }
    String bootstrappedVersion = properties.getProperty("version", "NONE");
//        LOG.lifecycle("found hybris platform version: {}", bootstrappedVersion);
    return bootstrappedVersion;
  }

代码示例来源:origin: io.github.gradle-clojure/gradle-clojure-plugin

@Internal
public Object getSourceMap() {
 File sourceMap = sourceMapFile.getAsFile().getOrNull();
 if (sourceMap == null) {
  return sourceMapEnabled;
 } else {
  return sourceMap;
 }
}

代码示例来源:origin: gradle-clojure/gradle-clojure

@Internal
public Object getSourceMap() {
 File sourceMap = sourceMapFile.getAsFile().getOrNull();
 if (sourceMap == null) {
  return sourceMapEnabled;
 } else {
  return sourceMap;
 }
}

相关文章