简体   繁体   中英

commons-configuration custom configuration file

I'd to save configuration as a list of sth like: 152.158.1545.415:80 Ok 152.108.145.415:80 152.158.115.415:80 500

instead of:

proxy= 152.108.145.415:80 proxy= 152.108.145.415:80 ... and read it. ( 152.108.145.415 as a string 80 as a number ). Can I do such a customisation in this library (commons-configuration)?

If you are using a PropertiesConfiguration you can customize the layout for the "proxy" property and have the values on a single line like this:

proxy=152.158.115.415:80,152.158.115.415:80,152.158.115.415:80 

You do this by calling:

configuration.getLayout().setSingleLine("proxy", true);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM