// Path: src/main/java/nl/ulso/sprox/ParseException.java
// public final class ParseException extends XmlProcessorException {
//     public ParseException(Class resultClass, String value) {
//         super(createMessage(resultClass, value));
//     }
// 
//     public ParseException(Class resultClass, String value, Throwable cause) {
//         super(createMessage(resultClass, value), cause);
//     }
// 
//     private static String createMessage(Class resultClass, String value) {
//         return "Could not parse string \"" + value + "\" into a value of type \"" + resultClass + "\"";
//     }
// }
// 
// Path: src/main/java/nl/ulso/sprox/Parser.java
// public interface Parser<T> {
// 
//     /**
//      * Parses a string value into a specific type.
//      *
//      * @param value String value to parse.
//      * @return The result of parsing the value.
//      * @throws ParseException If the value could not be parsed.
//      */
//     T fromString(String value) throws ParseException;
// }
// 
// Path: src/main/java/nl/ulso/sprox/impl/UncheckedXmlProcessorException.java
// static UncheckedXmlProcessorException unchecked(XmlProcessorException exception) {
//     return new UncheckedXmlProcessorException(exception);
// }


import nl.ulso.sprox.ParseException;
import nl.ulso.sprox.Parser;
import javax.xml.namespace.QName;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import static nl.ulso.sprox.impl.UncheckedXmlProcessorException.unchecked;
    // Mutable data, collected during a single processing run
    private final AttributeMap attributeMap;
    private final MethodResultMap methodResultMap;
    private final NodeContentMap nodeContentMap;
    private int depth;
    private T result;

    ExecutionContext(Class<T> resultClass, Map<Class, Object> controllers, Map<Class<?>, Parser<?>> parsers) {
        this.resultClass = resultClass;
        this.controllers = controllers;
        this.parsers = parsers;
        this.attributeMap = new AttributeMap();
        this.nodeContentMap = new NodeContentMap();
        this.methodResultMap = new MethodResultMap();
        this.depth = 0;
        this.result = null;
    }

    Object getController(Class controllerClass) {
        return controllers.get(controllerClass);
    }

    <R> R parseString(String value, Class<R> resultClass) {
        @SuppressWarnings("unchecked")
        final Parser<R> parser = (Parser<R>) parsers.get(resultClass);
        if (parser == null) {
            throw new IllegalStateException("No parser available for type: " + resultClass);
        }
        try {
            return parser.fromString(value);
// Path: src/main/java/nl/ulso/sprox/ParseException.java
// public final class ParseException extends XmlProcessorException {
//     public ParseException(Class resultClass, String value) {
//         super(createMessage(resultClass, value));
//     }
// 
//     public ParseException(Class resultClass, String value, Throwable cause) {
//         super(createMessage(resultClass, value), cause);
//     }
// 
//     private static String createMessage(Class resultClass, String value) {
//         return "Could not parse string \"" + value + "\" into a value of type \"" + resultClass + "\"";
//     }
// }
// 
// Path: src/main/java/nl/ulso/sprox/Parser.java
// public interface Parser<T> {
// 
//     /**
//      * Parses a string value into a specific type.
//      *
//      * @param value String value to parse.
//      * @return The result of parsing the value.
//      * @throws ParseException If the value could not be parsed.
//      */
//     T fromString(String value) throws ParseException;
// }
// 
// Path: src/main/java/nl/ulso/sprox/impl/UncheckedXmlProcessorException.java
// static UncheckedXmlProcessorException unchecked(XmlProcessorException exception) {
//     return new UncheckedXmlProcessorException(exception);
// }


// Path: src/main/java/nl/ulso/sprox/impl/ExecutionContext.java
import nl.ulso.sprox.ParseException;
import nl.ulso.sprox.Parser;
import javax.xml.namespace.QName;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import static nl.ulso.sprox.impl.UncheckedXmlProcessorException.unchecked;

    // Mutable data, collected during a single processing run
    private final AttributeMap attributeMap;
    private final MethodResultMap methodResultMap;
    private final NodeContentMap nodeContentMap;
    private int depth;
    private T result;

    ExecutionContext(Class<T> resultClass, Map<Class, Object> controllers, Map<Class<?>, Parser<?>> parsers) {
        this.resultClass = resultClass;
        this.controllers = controllers;
        this.parsers = parsers;
        this.attributeMap = new AttributeMap();
        this.nodeContentMap = new NodeContentMap();
        this.methodResultMap = new MethodResultMap();
        this.depth = 0;
        this.result = null;
    }

    Object getController(Class controllerClass) {
        return controllers.get(controllerClass);
    }

    <R> R parseString(String value, Class<R> resultClass) {
        @SuppressWarnings("unchecked")
        final Parser<R> parser = (Parser<R>) parsers.get(resultClass);
        if (parser == null) {
            throw new IllegalStateException("No parser available for type: " + resultClass);
        }
        try {
            return parser.fromString(value);
        } catch (ParseException e) {