Java Preference Get getNode(String path)

Here you can find the source of getNode(String path)

Description

Get node for package and path, return null if not already existing.

License

Open Source License

Parameter

Parameter Description
path The absolute path name of the node.

Return

The node or null, if node does not exist or failure in the backing store.

Declaration

public static Preferences getNode(String path) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;

public class Main {
    /** Get node for package and path, return null if not already existing.
    @param path The absolute path name of the node.
    @return The node or null, if node does not exist or failure in the
    backing store. *///from   w w  w. j a v  a 2  s. c o m
    public static Preferences getNode(String path) {
        assert !path.startsWith("/");
        Preferences prefs = Preferences.userRoot();
        try {
            if (!prefs.nodeExists(path))
                return null;
        } catch (BackingStoreException e) {
            return null;
        }
        return prefs.node(path);
    }
}

Related

  1. getClobStorage(Preferences prefs, String key)
  2. getDefault()
  3. getFloat(String key, Float def)
  4. getInt(final Class preferencesClass, final String preferenceName)
  5. getList(String path)
  6. getPreference(String key, Boolean defaultValue)
  7. getPreferences()
  8. getPreferences(final Class preferencesClass)
  9. getPrefs(Class cls)