Java Preference savePreference(String key, Object value)

Here you can find the source of savePreference(String key, Object value)

Description

save Preference

License

Open Source License

Declaration

public static void savePreference(String key, Object value) 

Method Source Code

//package com.java2s;

import java.util.prefs.Preferences;

public class Main {
    private static Preferences prefs = null;

    public static void savePreference(String key, Object value) {
        if (value instanceof String) {
            prefs.put(key, (String) value);
        } else if (value instanceof Boolean) {
            prefs.putBoolean(key, (Boolean) value);
        } else if (value instanceof Integer) {
            prefs.putInt(key, (Integer) value);
        }//from w ww  .  j a va  2  s.c om
    }
}

Related

  1. createNode(String path)
  2. hasEnv(String key, String value)
  3. initEnv(String key, String value)
  4. keyExists(String className, String prefName)
  5. readAllReg(String path)
  6. userNodeForClass(Class clazz)
  7. writeReg2(String name, String value, Class clazz)