KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > users > PropertyContainer


1 /*
2 Copyright (c) 2003 eInnovation Inc. All rights reserved
3
4 This library is free software; you can redistribute it and/or modify it under the terms
5 of the GNU Lesser General Public License as published by the Free Software Foundation;
6 either version 2.1 of the License, or (at your option) any later version.
7
8 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the GNU Lesser General Public License for more details.
11 */

12
13 package com.openedit.users;
14
15 import java.io.Serializable JavaDoc;
16 import java.util.Map JavaDoc;
17
18
19 /**
20  * This interface represents an object that can contain properties.
21  *
22  * @author Eric Galluzzo
23  */

24 public interface PropertyContainer extends Serializable JavaDoc
25 {
26     /**
27      * Get all the properties on this object as a read-only map.
28      *
29      * @return A read-only map of all the properties on this object
30      */

31     Map JavaDoc getProperties();
32
33     /**
34      * Get the value of the given property of this object.
35      *
36      * @param inPropertyName The property name
37      *
38      * @return The property value, or <code>null</code> if the property does not exist on this
39      * object
40      */

41     Object JavaDoc get(String JavaDoc inPropertyName);
42
43     /**
44      * Set the given property of this object. Note that depending on the implementation, only
45      * certain types may be supported for the property value. All implementations must support at
46      * least String. However, it is recommended that implementations support at least the
47      * following types:
48      *
49      * <ul>
50      * <li>
51      * Boolean
52      * </li>
53      * <li>
54      * Double
55      * </li>
56      * <li>
57      * Integer
58      * </li>
59      * <li>
60      * String
61      * </li>
62      * <li>
63      * Object[]
64      * </li>
65      * </ul>
66      *
67      * Property names must conform to the regular expression <code>[A-Za-z_][A-Za-z0-9_.]</code>.
68      * In other words, the first character must be an underscore or letter; and each subsequent
69      * character must be an underscore, period, letter, or digit.
70      *
71      * @param inPropertyName The property name
72      * @param inPropertyValue The property value
73      *
74      * @throws InvalidPropertyNameException If the property name was invalid
75      * @throws UnsupportedPropertyTypeException If the property value was of an unsupported type
76      * @throws UserManagerException If the property could not be set
77      */

78     void put(String JavaDoc inPropertyName, Object JavaDoc inPropertyValue)
79         throws UserManagerException;
80
81     /**
82      * Add all the specified properties to this object. Note that the keys in the given map must
83      * be strings (property names), and that the values must satisfy the implementation's
84      * requirements for property values.
85      *
86      * @param inProperties The properties to set
87      *
88      * @throws UserManagerException If any of the properties could not be set
89      *
90      * @see #put(String, Object)
91      */

92     void putAll(Map JavaDoc inProperties) throws UserManagerException;
93
94     /**
95      * Remove the given property from this object. If no such property exists, this method will do
96      * nothing.
97      *
98      * @param inPropertyName The name of the property to remove
99      *
100      * @throws UserManagerException If the property exists and could not be removed
101      */

102     void remove(String JavaDoc inPropertyName) throws UserManagerException;
103     
104     /**
105      * Remove the given properties from this object. Any properties that do not
106      * exist will be silently ignored.
107      *
108      * @param inProperties The names of the properties to remove
109      *
110      * @throws UserManagerException If a property exists and could not be removed
111      */

112     void removeAll( String JavaDoc[] inProperties ) throws UserManagerException;
113
114     /**
115      * Returns the value for the given property, converted from a String to a
116      * boolean.
117      *
118      * @param inPropertyName The property name
119      *
120      * @return The boolean value
121      */

122     boolean getBoolean( String JavaDoc inPropertyName );
123
124     /**
125      * Returns the string value for the given property.
126      *
127      * @param inPropertyName The property name
128      *
129      * @return The string value
130      */

131     String JavaDoc getString( String JavaDoc inPropertyName );
132
133     /**
134      * Puts the given property in this map, except that null values are removed
135      * and no saving is performed.
136      *
137      * @param inPropertyName The property name
138      * @param inPropertyValue The property value
139      */

140     void safePut( String JavaDoc inPropertyName, Object JavaDoc inPropertyValue );
141 }
142
Popular Tags