    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 */
    017package org.apache.commons.configuration2;
    018
    019/**
    020 * <p>
    021 * Definition of an interface to be implemented by {@code Configuration} implementations which support a special
    022 * initialization method.
    023 * </p>
    024 * <p>
    025 * This interface is mainly evaluated by <em>configuration builder</em> implementations: If a newly created
    026 * configuration instance implements this interface, the builder calls the {@code initialize()} method. This gives
    027 * {@code Configuration} classes the opportunity to perform additional initializations after all properties passed to
    028 * the builder have been set.
    029 * </p>
    030 * <p>
    031 * Another use case for this interface is to perform initializations directly which otherwise would have been done
    032 * lazily. Lazy initializations can be problematic regarding thread-safety. If in contrast a configuration instance has
    033 * been fully initialized when it is returned from the builder, it may be used with a {@code NoOpSynchronizer} if it is
    034 * not modified.
    035 * </p>
    036 *
    037 * @since 2.0
    038 */
    039public interface Initializable {
    040    /**
    041     * Initializes this object. A concrete implementation can use this method to perform arbitrary initialization.
    042     * Typically, this method is invoked by a <em>configuration builder</em>. In this case, the builder's lock is held, so
    043     * that all member fields set by this method are safely published.
    044     */
    045    void initialize();
    046}