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