class NamesResultProcessor extends ReadChildrenProcessor implements ResultProcessor {

    @Override
    protected List<ReadChildrenResult> processToModel(final String query, final ModelNode nodes) {
        return nodes.asList().stream()
                .map(node -> new ReadChildrenResult(node.asString()))
                .filter(result -> !isNullOrEmpty(query) &&
                        (SuggestHandler.SHOW_ALL_VALUE.equals(query) || result.name.contains(query)))
                .sorted(Comparator.comparing(result -> result.name))
                .collect(toList());
    }

}