ParameterTool extends ExecutionConfig.GlobalJobParameters implements Serializable, Cloneable { public static ParameterTool fromPropertiesFile(String path) throws IOException { File propertiesFile = new File(path); if(!propertiesFile.exists()) { throw new FileNotFoundException("Properties file "+path+" does not exist"); } Properties props = new Properties(); FileInputStream fis = new FileInputStream(propertiesFile); props.load(fis); fis.close(); return fromMap((Map)props); } private  ParameterTool(Map<String, String> data); static ParameterTool fromArgs(String[] args); static ParameterTool fromPropertiesFile(String path); static ParameterTool fromMap(Map<String, String> map); static ParameterTool fromSystemProperties(); @PublicEvolving static ParameterTool fromGenericOptionsParser(String[] args); int getNumberOfParameters(); String get(String key); String getRequired(String key); String get(String key, String defaultValue); boolean has(String value); int getInt(String key); int getInt(String key, int defaultValue); long getLong(String key); long getLong(String key, long defaultValue); float getFloat(String key); float getFloat(String key, float defaultValue); double getDouble(String key); double getDouble(String key, double defaultValue); boolean getBoolean(String key); boolean getBoolean(String key, boolean defaultValue); short getShort(String key); short getShort(String key, short defaultValue); byte getByte(String key); byte getByte(String key, byte defaultValue); Configuration getConfiguration(); Properties getProperties(); void createPropertiesFile(String pathToFile); void createPropertiesFile(String pathToFile, boolean overwrite); ParameterTool mergeWith(ParameterTool other); @Override Map<String, String> toMap();  }
@Test public void testFromPropertiesFile() throws IOException { File propertiesFile = tmp.newFile(); Properties props = new Properties(); props.setProperty("input", "myInput"); props.setProperty("expectedCount", "15"); props.store(new FileOutputStream(propertiesFile), "Test properties"); ParameterTool parameter = ParameterTool.fromPropertiesFile(propertiesFile.getAbsolutePath()); Assert.assertEquals(2, parameter.getNumberOfParameters()); validate(parameter); }