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.log4j.config; 018 019import java.beans.PropertyDescriptor; 020import java.util.Properties; 021 022/** 023 * 024 * @since 1.1 025 */ 026public class PropertySetter { 027 028 /** 029 * Create a new PropertySetter for the specified Object. This is done 030 * in preparation for invoking {@link #setProperty} one or more times. 031 * 032 * @param obj the object for which to set properties 033 */ 034 public PropertySetter(final Object obj) { 035 } 036 037 038 /** 039 * Set the properties for the object that match the <code>prefix</code> passed as parameter. 040 * 041 * @param properties The properties 042 * @param prefix The prefix 043 */ 044 public void setProperties(final Properties properties, final String prefix) { 045 } 046 047 /** 048 * Set a property on this PropertySetter's Object. If successful, this 049 * method will invoke a setter method on the underlying Object. The 050 * setter is the one for the specified property name and the value is 051 * determined partly from the setter argument type and partly from the 052 * value specified in the call to this method. 053 * 054 * <p>If the setter expects a String no conversion is necessary. 055 * If it expects an int, then an attempt is made to convert 'value' 056 * to an int using new Integer(value). If the setter expects a boolean, 057 * the conversion is by new Boolean(value). 058 * 059 * @param name name of the property 060 * @param value String value of the property 061 */ 062 public void setProperty(final String name, final String value) { 063 } 064 065 /** 066 * Set the named property given a {@link PropertyDescriptor}. 067 * 068 * @param prop A PropertyDescriptor describing the characteristics of the property to set. 069 * @param name The named of the property to set. 070 * @param value The value of the property. 071 * @throws PropertySetterException (Never actually throws this exception. Kept for historical purposes.) 072 */ 073 public void setProperty(final PropertyDescriptor prop, final String name, final String value) 074 throws PropertySetterException { 075 } 076 077 /** 078 * Set the properties of an object passed as a parameter in one 079 * go. The <code>properties</code> are parsed relative to a 080 * <code>prefix</code>. 081 * 082 * @param obj The object to configure. 083 * @param properties A java.util.Properties containing keys and values. 084 * @param prefix Only keys having the specified prefix will be set. 085 */ 086 public static void setProperties(final Object obj, final Properties properties, final String prefix) { 087 } 088}