    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 *     http://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 */
    017package org.apache.commons.configuration2;
    018
    019/**
    020 * <p>
    021 * An interface for decoding encoded values from a configuration source.
    022 * </p>
    023 * <p>
    024 * Using this interface it is possible to store encoded or encrypted values in a configuration file. An implementing
    025 * object can be assigned to a configuration object. The {@code getEncodedString()} method of the
    026 * {@link ImmutableConfiguration} interface makes use of this instance to decode the value read from the configuration
    027 * file before it is passed to the caller.
    028 * </p>
    029 * <p>
    030 * By providing custom implementations of this interface an application can add support for different kinds of encoded
    031 * strings in configuration files.
    032 * </p>
    033 *
    034 * @since 2.0
    035 */
    036public interface ConfigurationDecoder {
    037    /**
    038     * Decodes the specified string. This method is called with a string in encoded form read from a configuration file. An
    039     * implementation has to be perform an appropriate decoding and return the result. This result is passed to the calling
    040     * application; so it should be in a readable form.
    041     *
    042     * @param s the string to be decoded (not <strong>null</strong>)
    043     * @return the decoded string
    044     */
    045    String decode(String s);
    046}