public static String getPippoVersion ( ) { // and the key inside the properties file. String pippoVersionPropertyKey = "pippo.version" ; String pippoVersion ; try { Properties prop = new Properties ( ) ; URL url = ClasspathUtils . locateOnClasspath ( PippoConstants . LOCATION_OF_PIPPO_BUILTIN_PROPERTIES ) ; InputStream stream = url . openStream ( ) ; prop . load ( stream ) ; pippoVersion = prop . getProperty ( pippoVersionPropertyKey ) ; } catch ( Exception e ) { //this should not happen. Never. throw new PippoRuntimeException ( "Something is wrong with your build. Cannot find resource {}" , PippoConstants . LOCATION_OF_PIPPO_BUILTIN_PROPERTIES ) ; } return pippoVersion ; }
Simply reads a property resource file that contains the version of this Pippo build . Helps to identify the Pippo version currently running .