사용자가 임의의 수의 개체 목록을 저장 /로드 할 수 있도록해야합니다 (일련 화 가능하다고 가정). 개념적으로 나는 java : Preferences API 대 Apache Commons Configuration
class FooBean { /* bean stuff here */ }
class FooList {
final private Set<FooBean> items = new HashSet<FooBean>();
public boolean add(FooBean item) { return items.add(item); }
public boolean remove(FooBean item) { return items.remove(item); }
public Collection<FooBean> getItems() {
return Collections.unmodifiableSet(items);
}
}
class FooStore {
public FooStore() {
/* something... uses Preferences or Commons Configuration */
}
public FooList load(String key) {
/* something... retrieves a FooList associated with the key */
}
public void store(String key, FooList items) {
/* something... saves a FooList under the given key */
}
}
같은 데이터 모델 내가
Preferences API 또는
Commons Config 사용해야 싶어? 각각의 장점은 무엇입니까?