    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *     https://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017
    018package org.apache.commons.configuration2.builder;
    019
    020import java.util.Map;
    021
    022import org.apache.commons.configuration2.tree.ExpressionEngine;
    023
    024/**
    025 * A specialized parameters object for hierarchical configurations.
    026 * <p>
    027 * This class defines special properties for hierarchical configurations. Because most hierarchical configurations are file-based configurations this class
    028 * extends {@code FileBasedBuilderParametersImpl}.
    029 * </p>
    030 *
    031 * @since 2.0
    032 */
    033public class HierarchicalBuilderParametersImpl extends FileBasedBuilderParametersImpl
    034        implements HierarchicalBuilderProperties<HierarchicalBuilderParametersImpl> {
    035
    036    /** Constant for the expression engine property. */
    037    private static final String PROP_EXPRESSION_ENGINE = "expressionEngine";
    038
    039    /**
    040     * Constructs a new instance.
    041     */
    042    public HierarchicalBuilderParametersImpl() {
    043        // empty
    044    }
    045
    046    /**
    047     * {@inheritDoc} This implementation copies some more properties defined by this class.
    048     */
    049    @Override
    050    public void inheritFrom(final Map<String, ?> source) {
    051        super.inheritFrom(source);
    052        copyPropertiesFrom(source, PROP_EXPRESSION_ENGINE);
    053    }
    054
    055    /**
    056     * {@inheritDoc} This implementation stores the expression engine in the internal parameters map.
    057     */
    058    @Override
    059    public HierarchicalBuilderParametersImpl setExpressionEngine(final ExpressionEngine engine) {
    060        storeProperty(PROP_EXPRESSION_ENGINE, engine);
    061        return this;
    062    }
    063}