238 |
* @exception SecurityException when a security manager is installed and |
* @exception SecurityException when a security manager is installed and |
239 |
* the caller does not have <code>RuntimePermission("preferences")</code>. |
* the caller does not have <code>RuntimePermission("preferences")</code>. |
240 |
*/ |
*/ |
241 |
public static Preferences systemNodeForPackage(Object o) |
public static Preferences systemNodeForPackage(Class c) |
242 |
throws SecurityException |
throws SecurityException |
243 |
{ |
{ |
244 |
return nodeForPackage(o, systemRoot()); |
return nodeForPackage(c, systemRoot()); |
245 |
} |
} |
246 |
|
|
247 |
/** |
/** |
257 |
* @exception SecurityException when a security manager is installed and |
* @exception SecurityException when a security manager is installed and |
258 |
* the caller does not have <code>RuntimePermission("preferences")</code>. |
* the caller does not have <code>RuntimePermission("preferences")</code>. |
259 |
*/ |
*/ |
260 |
public static Preferences userNodeForPackage(Object o) |
public static Preferences userNodeForPackage(Class c) |
261 |
throws SecurityException |
throws SecurityException |
262 |
{ |
{ |
263 |
return nodeForPackage(o, userRoot()); |
return nodeForPackage(c, userRoot()); |
264 |
} |
} |
265 |
|
|
266 |
/** |
/** |
269 |
* root it returns the correct Preference node for the package node name |
* root it returns the correct Preference node for the package node name |
270 |
* of the given object. |
* of the given object. |
271 |
*/ |
*/ |
272 |
private static Preferences nodeForPackage(Object o, Preferences root) { |
private static Preferences nodeForPackage(Class c, Preferences root) { |
273 |
// Get the package path |
// Get the package path |
274 |
String className = o.getClass().getName(); |
String className = c.getName(); |
275 |
String packagePath; |
String packagePath; |
276 |
int index = className.lastIndexOf('.'); |
int index = className.lastIndexOf('.'); |
277 |
if(index == -1) { |
if(index == -1) { |