// Path: src/main/java/io/smartcat/ranger/core/ConstantValue.java
// public class ConstantValue<T> extends Value<T> {
// 
//     /**
//      * Constructs constant value which will always return specified <code>value</code>.
//      *
//      * @param value Value to be returned.
//      */
//     public ConstantValue(T value) {
//         this.val = value;
//     }
// 
//     /**
//      * Helper method to construct {@link ConstantValue}.
//      *
//      * @param value Value to be returned by created constant value.
//      * @param <T> Type this value would evaluate to.
//      *
//      * @return An instance of {@link ConstantValue}.
//      */
//     public static <T> ConstantValue<T> of(T value) {
//         return new ConstantValue<T>(value);
//     }
// }
// 
// Path: src/main/java/io/smartcat/ranger/core/ValueProxy.java
// public class ValueProxy<T> extends Value<T> {
// 
//     private Value<T> delegate;
// 
//     /**
//      * Constructs proxy without delegate.
//      */
//     public ValueProxy() {
//     }
// 
//     /**
//      * Constructs proxy with specified <code>delegate</code>.
//      *
//      * @param delegate Value which will be evaluated and cached.
//      */
//     public ValueProxy(Value<T> delegate) {
//         setDelegate(delegate);
//     }
// 
//     /**
//      * Sets value to this proxy.
//      *
//      * @param delegate Value which will be evaluated and cached.
//      */
//     public void setDelegate(Value<T> delegate) {
//         if (delegate == null) {
//             throw new IllegalArgumentException("Delegate cannot be null.");
//         }
//         this.delegate = delegate;
//     }
// 
//     @Override
//     public void reset() {
//         super.reset();
//         checkDelegate();
//         delegate.reset();
//     }
// 
//     @Override
//     protected void eval() {
//         checkDelegate();
//         val = delegate.get();
//     }
// 
//     private void checkDelegate() {
//         if (delegate == null) {
//             throw new DelegateNotSetException();
//         }
//     }
// 
//     /**
//      * Signals that delegate is not set.
//      */
//     public static class DelegateNotSetException extends RuntimeException {
// 
//         private static final long serialVersionUID = 6257779717961934851L;
// 
//         /**
//          * Constructs {@link DelegateNotSetException} with default message.
//          */
//         public DelegateNotSetException() {
//             super("Delegate not set for ValueProxy.");
//         }
//     }
// }


import io.smartcat.ranger.ObjectGenerator;
import io.smartcat.ranger.core.CompositeValue;
import io.smartcat.ranger.core.ConstantValue;
import io.smartcat.ranger.core.TypeConverterValue;
import io.smartcat.ranger.core.Value;
import io.smartcat.ranger.core.ValueProxy;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.ReportingParseRunner;
import org.parboiled.support.ParsingResult;
import java.util.HashMap;
import java.util.Map;

    @SuppressWarnings("unchecked")
    private Value<?> parse(String parentName, Object def) {
        if (def instanceof Map) {
            return parseCompositeValue(parentName, (Map<String, Object>) def);
        } else {
            return parseSimpleValue(parentName, def);
        }
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    private Value<?> parseCompositeValue(String parentName, Map<String, Object> def) {
        Map<String, Value<?>> values = new HashMap<>();
        for (String property : def.keySet()) {
            String fullName = parentName + "." + property;
            Value<?> val = parse(fullName, def.get(property));
            ValueProxy proxy = proxyValues.get(fullName);
            proxy.setDelegate(val);
            values.put(property, proxy);
        }
        return new CompositeValue(values);
    }

    private Value<?> parseSimpleValue(String parentName, Object def) {
        // handle String as expression and all other types as primitives
        if (def instanceof String) {
            parser.setParentName(stripOffLastReference(parentName));
            ParsingResult<Value<?>> result = parseRunner.run((String) def);
            return result.valueStack.pop();
        } else {
// Path: src/main/java/io/smartcat/ranger/core/ConstantValue.java
// public class ConstantValue<T> extends Value<T> {
// 
//     /**
//      * Constructs constant value which will always return specified <code>value</code>.
//      *
//      * @param value Value to be returned.
//      */
//     public ConstantValue(T value) {
//         this.val = value;
//     }
// 
//     /**
//      * Helper method to construct {@link ConstantValue}.
//      *
//      * @param value Value to be returned by created constant value.
//      * @param <T> Type this value would evaluate to.
//      *
//      * @return An instance of {@link ConstantValue}.
//      */
//     public static <T> ConstantValue<T> of(T value) {
//         return new ConstantValue<T>(value);
//     }
// }
// 
// Path: src/main/java/io/smartcat/ranger/core/ValueProxy.java
// public class ValueProxy<T> extends Value<T> {
// 
//     private Value<T> delegate;
// 
//     /**
//      * Constructs proxy without delegate.
//      */
//     public ValueProxy() {
//     }
// 
//     /**
//      * Constructs proxy with specified <code>delegate</code>.
//      *
//      * @param delegate Value which will be evaluated and cached.
//      */
//     public ValueProxy(Value<T> delegate) {
//         setDelegate(delegate);
//     }
// 
//     /**
//      * Sets value to this proxy.
//      *
//      * @param delegate Value which will be evaluated and cached.
//      */
//     public void setDelegate(Value<T> delegate) {
//         if (delegate == null) {
//             throw new IllegalArgumentException("Delegate cannot be null.");
//         }
//         this.delegate = delegate;
//     }
// 
//     @Override
//     public void reset() {
//         super.reset();
//         checkDelegate();
//         delegate.reset();
//     }
// 
//     @Override
//     protected void eval() {
//         checkDelegate();
//         val = delegate.get();
//     }
// 
//     private void checkDelegate() {
//         if (delegate == null) {
//             throw new DelegateNotSetException();
//         }
//     }
// 
//     /**
//      * Signals that delegate is not set.
//      */
//     public static class DelegateNotSetException extends RuntimeException {
// 
//         private static final long serialVersionUID = 6257779717961934851L;
// 
//         /**
//          * Constructs {@link DelegateNotSetException} with default message.
//          */
//         public DelegateNotSetException() {
//             super("Delegate not set for ValueProxy.");
//         }
//     }
// }


// Path: src/main/java/io/smartcat/ranger/parser/ConfigurationParser.java
import io.smartcat.ranger.ObjectGenerator;
import io.smartcat.ranger.core.CompositeValue;
import io.smartcat.ranger.core.ConstantValue;
import io.smartcat.ranger.core.TypeConverterValue;
import io.smartcat.ranger.core.Value;
import io.smartcat.ranger.core.ValueProxy;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.ReportingParseRunner;
import org.parboiled.support.ParsingResult;
import java.util.HashMap;
import java.util.Map;


    @SuppressWarnings("unchecked")
    private Value<?> parse(String parentName, Object def) {
        if (def instanceof Map) {
            return parseCompositeValue(parentName, (Map<String, Object>) def);
        } else {
            return parseSimpleValue(parentName, def);
        }
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    private Value<?> parseCompositeValue(String parentName, Map<String, Object> def) {
        Map<String, Value<?>> values = new HashMap<>();
        for (String property : def.keySet()) {
            String fullName = parentName + "." + property;
            Value<?> val = parse(fullName, def.get(property));
            ValueProxy proxy = proxyValues.get(fullName);
            proxy.setDelegate(val);
            values.put(property, proxy);
        }
        return new CompositeValue(values);
    }

    private Value<?> parseSimpleValue(String parentName, Object def) {
        // handle String as expression and all other types as primitives
        if (def instanceof String) {
            parser.setParentName(stripOffLastReference(parentName));
            ParsingResult<Value<?>> result = parseRunner.run((String) def);
            return result.valueStack.pop();
        } else {
            return ConstantValue.of(def);