Source code
Description: source: package: org.apache.commons.configuration2.builder, class: JndiBuilderParametersImpl

    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.builder;
    018
    019import javax.naming.Context;
    020
    021/**
    022 * <p>
    023 * A specialized parameters object for JNDI configurations.
    024 * </p>
    025 * <p>
    026 * In addition to the basic properties common to all configuration implementations, a JNDI configuration has some
    027 * special properties defining the subset of the JNDI tree to be managed. This class provides fluent methods for setting
    028 * these. The {@code getParameters()} method puts all properties defined by the user in a map from where they can be
    029 * accessed by a builder for JNDI configurations.
    030 * </p>
    031 * <p>
    032 * This class is not thread-safe. It is intended that an instance is constructed and initialized by a single thread
    033 * during configuration of a {@code ConfigurationBuilder}.
    034 * </p>
    035 *
    036 * @since 2.0
    037 */
    038public class JndiBuilderParametersImpl extends BasicBuilderParameters implements JndiBuilderProperties<JndiBuilderParametersImpl> {
    039
    040    /** Constant for the name of the context property. */
    041    private static final String PROP_CONTEXT = "context";
    042
    043    /** Constant for the name of the prefix property. */
    044    private static final String PROP_PREFIX = "prefix";
    045
    046    /**
    047     * Constructs a new instance.
    048     */
    049    public JndiBuilderParametersImpl() {
    050        // empty
    051    }
    052
    053    @Override
    054    public JndiBuilderParametersImpl setContext(final Context ctx) {
    055        storeProperty(PROP_CONTEXT, ctx);
    056        return this;
    057    }
    058
    059    @Override
    060    public JndiBuilderParametersImpl setPrefix(final String p) {
    061        storeProperty(PROP_PREFIX, p);
    062        return this;
    063    }
    064}