class DetectorFactory {

    public Detector buildDetector(DetectorDocument document) {
        notNull(document, "document can't be null");
        val type = document.getType();
        val factory = providers.get(type);
        if (factory == null) {
            throw new DetectorException("Illegal detector type: " + type);
        }
        return factory.buildDetector(document);
    }

    public  DetectorFactory();

}