if (sortAlfabeticalOnly) {
wrapperFactory = new WrapperFactory() {
@Override
public HierarchyWrapper createFromRootElement(final Element rootElement) {
return new HierarchyWrapper(new AlphabeticalSortedWrapper(rootElement));
}
@SuppressWarnings("unchecked")
@Override
public <T extends Content> Wrapper<T> create(final T content) {
if (content instanceof Element) {
Element element = (Element) content;
return (Wrapper<T>) new AlphabeticalSortedWrapper(element);
}
return new UnsortedWrapper<T>(content);
}
};