View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements. See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache license, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License. You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the license for the specific language governing permissions and
15   * limitations under the license.
16   */
17  package org.apache.log4j.config;
18  
19  import java.beans.PropertyDescriptor;
20  import java.util.Properties;
21  
22  /**
23   *
24   * @since 1.1
25   */
26  public class PropertySetter {
27  
28      /**
29       * Create a new PropertySetter for the specified Object. This is done
30       * in prepartion for invoking {@link #setProperty} one or more times.
31       *
32       * @param obj  the object for which to set properties
33       */
34      public PropertySetter(Object obj) {
35      }
36  
37      /**
38       Set the properties of an object passed as a parameter in one
39       go. The <code>properties</code> are parsed relative to a
40       <code>prefix</code>.
41  
42       @param obj The object to configure.
43       @param properties A java.util.Properties containing keys and values.
44       @param prefix Only keys having the specified prefix will be set.
45       */
46      public static void setProperties(Object obj, Properties properties, String prefix) {
47      }
48  
49  
50      /**
51       * Set the properites for the object that match the <code>prefix</code> passed as parameter.
52       */
53      public void setProperties(Properties properties, String prefix) {
54      }
55  
56      /**
57       Set a property on this PropertySetter's Object. If successful, this
58       method will invoke a setter method on the underlying Object. The
59       setter is the one for the specified property name and the value is
60       determined partly from the setter argument type and partly from the
61       value specified in the call to this method.
62  
63       <p>If the setter expects a String no conversion is necessary.
64       If it expects an int, then an attempt is made to convert 'value'
65       to an int using new Integer(value). If the setter expects a boolean,
66       the conversion is by new Boolean(value).
67  
68       @param name    name of the property
69       @param value   String value of the property
70       */
71      public void setProperty(String name, String value) {
72      }
73  
74      /**
75       Set the named property given a {@link PropertyDescriptor}.
76  
77       @param prop A PropertyDescriptor describing the characteristics
78       of the property to set.
79       @param name The named of the property to set.
80       @param value The value of the property.
81       */
82      public void setProperty(PropertyDescriptor prop, String name, String value)
83          throws PropertySetterException {
84      }
85  
86  }