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