Code example for Properties

Methods: get, load

0
 
	private final String description; // =${git.commit.id.description}
	private final String buildTime; // =${git.build.time}
 
	private GitRepositoryState() throws IOException { 
		Properties properties = new Properties();
		InputStream str = GitRepositoryState.class.getClassLoader().getResourceAsStream("git.properties");
		if (str !=null) {
			properties.load(str);
	 
			Object desc = properties.get("git.commit.id.description");
			this.description = (desc == null)? "" : desc.toString();
	 
			Object time = properties.get("git.build.time");
			this.buildTime = time.toString();
		} else { 
			this.description="Unknown build";
			this.buildTime="Unknown";
		} 
	}