This sample show us how to use the PropertyManager
Este ejemplo nos muestra como utilizar el PropertyManager
:::properties
finders=switch,environment,system
finder.switch.class= ar.com.scf.impl.PropertyFinder
finder.switch.params= sample03/switch.properties
finder.environment.class= ar.com.scf.impl.PropertyFinder
finder.environment.params= sample03/${environment}.properties
finder.system.class= ar.com.scf.impl.SystemPropertyFinder
finder.system.params
:::properties
environment=linux
:::properties
config.os.name=Linux
:::properties
config.os.name=Windows
:::java
package ar.com.scf.sample03;
import java.io.File;
import ar.com.scf.impl.PropertyManager;
public class Sample {
public static void main(String[] args) {
PropertyManager manager = new PropertyManager(new File("sample03/config.properties"));
System.out.println(manager.getReplacer().expand("Current S.O. config: ${config.os.name}"));
System.out.println(manager.getReplacer().expand("Current S.O.: ${os.name}"));
}
}
:::console
Current S.O. config: Linux
Current S.O.: Windows XP