johnniang
就像ContentIndexController 里面的
String indexSort = optionService.getByPropertyOfNonNull(PostProperties.INDEX_SORT).toString();
调用OptionServiceImpl类
@Override
public Object getByKeyOfNonNull(String key) {
return getByKey(key).orElseThrow(() -> new MissingPropertyException("You have to config " + key + " setting"));
}
@Override
public Optional<Object> getByKey(String key) {
Assert.hasText(key, "Option key must not be blank");
return Optional.ofNullable(listOptions().get(key));
}
@Override
public Object getByPropertyOfNullable(PropertyEnum property) {
return getByProperty(property).orElse(null);
}
@Override
public Object getByPropertyOfNonNull(PropertyEnum property) {
Assert.notNull(property, "Blog property must not be null");
return getByKeyOfNonNull(property.getValue());
}
类里面的方法之间的相互调用 是为了解耦吗 不太明白这是干嘛的