All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.darwinsys.util.PrefsUtils Maven / Gradle / Ivy

package com.darwinsys.util;

import java.util.prefs.Preferences;

public class PrefsUtils {

	/** Gets the Preferences node for a package, given one class in the package
	 * (either by reference or by reference to its Class object).
	 * @param mainClassInstance Either the object, or the object's Class object.
	 * @return the appropriate Preferences node
	 */
	public static Preferences getUserPrefsNode(Object mainClassInstance) {
		Class clazz;
		if (mainClassInstance instanceof Class)
			clazz = (Class)mainClassInstance;
		else
			clazz = mainClassInstance.getClass();
		return Preferences.userNodeForPackage(clazz);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy