org.apache.tools.ant.Project.getProperties()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(134)

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

Project.getProperties介绍

[英]Return a copy of the properties table.
[中]返回属性表的副本。

代码示例

代码示例来源:origin: apache/groovy

public synchronized boolean isEmpty() {
  return project.getProperties().isEmpty();
}

代码示例来源:origin: apache/groovy

public synchronized int size() {
  return project.getProperties().size();
}

代码示例来源:origin: apache/groovy

public Collection values() {
  return project.getProperties().values();
}

代码示例来源:origin: apache/groovy

public synchronized Enumeration keys() {
  return project.getProperties().keys();
}

代码示例来源:origin: apache/groovy

public Set keySet() {
  return project.getProperties().keySet();
}

代码示例来源:origin: apache/groovy

public synchronized Enumeration elements() {
  return project.getProperties().elements();
}

代码示例来源:origin: apache/groovy

public synchronized Object clone() {
  return project.getProperties().clone();
}

代码示例来源:origin: apache/groovy

public synchronized boolean containsKey(Object key) {
  return project.getProperties().containsKey(key);
}

代码示例来源:origin: apache/groovy

public synchronized Object get(Object key) {
  return project.getProperties().get(key);
}

代码示例来源:origin: apache/groovy

public Set entrySet() {
  return project.getProperties().entrySet();
}

代码示例来源:origin: apache/groovy

public boolean containsValue(Object value) {
  return project.getProperties().containsValue(value);
}

代码示例来源:origin: apache/groovy

public synchronized int hashCode() {
  return project.getProperties().hashCode();
}

代码示例来源:origin: apache/groovy

public synchronized boolean equals(Object o) {
  return project.getProperties().equals(o);
}

代码示例来源:origin: apache/groovy

public synchronized boolean contains(Object value) {
  return project.getProperties().contains(value);
}

代码示例来源:origin: apache/groovy

public synchronized String toString() {
  return project.getProperties().toString();
}

代码示例来源:origin: hibernate/hibernate-orm

private void configure(StandardServiceRegistryBuilder registryBuilder) throws IOException {
  if ( configurationFile != null ) {
    registryBuilder.configure( configurationFile );
  }
  Properties properties = new Properties();
  if ( propertiesFile == null ) {
    properties.putAll( getProject().getProperties() );
  }
  else {
    properties.load( new FileInputStream( propertiesFile ) );
  }
  registryBuilder.applySettings( properties );
}

代码示例来源:origin: hibernate/hibernate-orm

private void configure(StandardServiceRegistryBuilder registryBuilder) throws IOException {
  if ( configurationFile != null ) {
    registryBuilder.configure( configurationFile );
  }
  Properties properties = new Properties();
  if ( propertiesFile == null ) {
    properties.putAll( getProject().getProperties() );
  }
  else {
    try (FileInputStream fip = new FileInputStream( propertiesFile )){
      properties.load( fip );
    } 
  }
  registryBuilder.applySettings( properties );
}

代码示例来源:origin: org.apache.ant/ant

private Map<String, Object> getEffectiveProperties() {
  final Project prj = getProject();
  final Map<String, Object> result = prj == null ? getAllSystemProperties() : prj.getProperties();
  //quick & dirty, to make nested mapped p-sets work:
  for (PropertySet set : setRefs) {
    result.putAll(set.getPropertyMap());
  }
  return result;
}

代码示例来源:origin: org.freemarker/freemarker

public void execute(Map vars) throws BuildException {
  if (scriptFile != null) {
    ensureJythonOpsExists();
    jythonOps.execute(scriptFile, vars);
  } 
  if (script.trim().length() > 0) {
    ensureJythonOpsExists();
    String finalScript = ProjectHelper.replaceProperties(
        project, script, project.getProperties());
    jythonOps.execute(finalScript, vars);
  }
}

代码示例来源:origin: checkstyle/checkstyle

@Test
public final void testFailureProperty() throws IOException {
  final CheckstyleAntTask antTask = new CheckstyleAntTask();
  antTask.setConfig(getPath(CONFIG_FILE));
  antTask.setFile(new File(getPath(VIOLATED_INPUT)));
  final Project project = new Project();
  final String failurePropertyName = "myProperty";
  project.setProperty(failurePropertyName, FAILURE_PROPERTY_VALUE);
  antTask.setProject(project);
  antTask.setFailureProperty(failurePropertyName);
  try {
    antTask.execute();
    fail("Exception is expected");
  }
  catch (BuildException ignored) {
    final Map<String, Object> hashtable = project.getProperties();
    final Object propertyValue = hashtable.get(failurePropertyName);
    assertEquals("Number of errors is unexpected",
        "Got 2 errors and 0 warnings.", propertyValue);
  }
}

相关文章