首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > Java > dynamic-property-binder

dynamic-property-binder

  • 资源大小:23.05 kB
  • 上传时间:2021-06-30
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签:

资 源 简 介

This tool allows configuration files (such as .properties and .xml) to be bound dynamically and painlessly into a Java interface. This has the benefit of cutting significantly on the boiler plate code of reading property files for every project. In addition, it supports serializing String properties as well as parameterized List properties. This is accomplished through meta-programming. In a nutshell, you create simple Java interface and use annotations to specify what the configuration file will be and how the properties will be interpreted. Here is a simple example: Property Files MainConfiguration.java ``` @Configurable(name="app.properties") public interface MainConfiguration { @Property(key="prop1_key") String getValue2ListAsString(); @Property(key="prop2_key") List getValue2List(); } ``` In this example above, I created an interface called MainConfiguration. Using this interfa
VIP VIP
0.223670s