这方法对你需要为显示解析的小字段和文档工作得最好。
This works best with fairly small fields and documents that you'd need to parse for display anyway.
有些框架还使用 get/set 方法,而不是这里显示的公共字段,但原理是相同的。
Some frameworks also use get/set methods rather than the public fields shown here, but the principle remains the same.
清单 20 中显示的两个 getProperty() 方法委托 TypeGetter 来获取配置字段,如果配置中没有指定值,则处理默认值。
The two getProperty() methods, shown in Listing 20, delegate to the TypeGetter to retrieve the configuration field, handling default values if no value was specified in the configuration.
应用推荐