Gruppe-02-clone/Projekte/common/src/main/java/pp/util/PreferencesUtils.java
2024-09-18 17:04:31 +02:00

31 lines
845 B
Java

////////////////////////////////////////
// Programming project code
// UniBw M, 2022, 2023, 2024
// www.unibw.de/inf2
// (c) Mark Minas (mark.minas@unibw.de)
////////////////////////////////////////
package pp.util;
import java.util.prefs.Preferences;
/**
* A class with convenience methods for preferences.
*/
public class PreferencesUtils {
private PreferencesUtils() {
// don't instantiate
}
/**
* Returns a preferences node for the specified class object. The path of the
* preference node corresponds to the fully qualified name of the class.
*
* @param clazz a class object
* @return a preference node for the specified class
*/
public static Preferences getPreferences(Class<?> clazz) {
return Preferences.userNodeForPackage(clazz).node(clazz.getSimpleName());
}
}