类java.util.prefs.AbstractPreferences源码实例Demo

下面列出了怎么用java.util.prefs.AbstractPreferences的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: netbeans   文件: CodeStylePreferences.java
@Override
        protected AbstractPreferences childSpi(String name) {
            if (prefs == null) {
                prefs = new HashMap<String, AbstractPreferences>(3);
            }
            AbstractPreferences p = prefs.get(name);
            if (p == null) {
//                root.cacheMisses++;
                Preferences r = delegate.node(name);
                p = new CachingPreferences(this, name, r);
//                ((CachingPreferences)p).root = this.root;
                prefs.put(name, p);
//            } else {
//                root.cacheHits++;
            }
            return p;
        }
 
源代码2 项目: netbeans   文件: XMLHintPreferences.java
@Override
protected AbstractPreferences childSpi(String name) {
    String escapedName = escape(name);
    NodeList nl = node.getElementsByTagName("node");
    
    for (int i = 0; i < nl.getLength(); i++) {
        Node n = nl.item(i);

        if (n instanceof Element && escapedName.equals(((Element) n).getAttribute("name"))) {
            return new XMLHintPreferences(driver, this, name, (Element) n, node, true);
        }
    }

    Element nue = node.getOwnerDocument().createElement("node");
    
    nue.setAttribute("name", escapedName);

    return new XMLHintPreferences(driver, this, name, nue, node, false);
}
 
/**
  * http://stackoverflow.com/a/24249709
  */
 @NotNull
 @Override
 protected AbstractPreferences childSpi(@NotNull String name) {
AbstractPreferences childPreferenceNode = (AbstractPreferences) children.get(name);
   boolean isChildRemoved = false;
   if (childPreferenceNode != null) {
     try {
       isChildRemoved = getIsRemoved(childPreferenceNode);
     } catch (ReflectiveOperationException e) {
       Log.error( e.getMessage() );
     }
   }
   if (childPreferenceNode == null || isChildRemoved) {
     final AbstractPreferences castedPreferences = new MarginallyCleverPreferences(this, name);
     childPreferenceNode = castedPreferences;
     children.put(name, childPreferenceNode);
   }
   return childPreferenceNode;
 }
 
/**
  * http://stackoverflow.com/a/24249709
  *
  * @param name
  * @return
  */
 @NotNull
 @Override
 protected AbstractPreferences childSpi(@NotNull String name) {
AbstractPreferences childPreferenceNode = (AbstractPreferences) children.get(name);
   boolean isChildRemoved = false;
   if (childPreferenceNode != null) {
     try {
       isChildRemoved = getIsRemoved(childPreferenceNode);
     } catch (ReflectiveOperationException e) {
       Log.error( e.getMessage() );
     }
   }
   if (childPreferenceNode == null || isChildRemoved) {
     final AbstractPreferences castedPreferences = new MarginallyCleverPreferences(this, name);
     childPreferenceNode = castedPreferences;
     children.put(name, childPreferenceNode);
   }
   return childPreferenceNode;
 }
 
@Override
protected AbstractPreferences childSpi(String name) {
	AbstractPreferences child = children.get(name);
	if (child == null) {
		child = new MockPreferences(this, name);
		children.put(name, child);
	}
	return child;
}
 
@Override
protected AbstractPreferences childSpi(String name) {
	AbstractPreferences child = children.get(name);
	if (child == null) {
		child = new MockPreferences(this, name);
		children.put(name, child);
	}
	return child;
}
 
源代码7 项目: netbeans   文件: InheritedPreferences.java
@Override
protected AbstractPreferences childSpi(String name) {
    Preferences storedNode = stored != null ? stored.node(name) : null;
    if (storedNode != null) {
        return new InheritedPreferences(null, storedNode);
    } else {
        return null;
    }
}
 
源代码8 项目: netbeans   文件: AdjustConfigurationPanel.java
protected AbstractPreferences childSpi(String name) {
    ModifiedPreferences result = subNodes.get(name);

    if (result == null) {
        subNodes.put(name, result = new ModifiedPreferences(this, name));
    }

    return result;
}
 
@Override
protected AbstractPreferences childSpi(String name) {
    synchronized (AuxiliaryConfigBasedPreferencesProvider.this) {
        String nuePath = path + "/" + name;
        if (!getChildrenNames().contains(name)) {
            AuxiliaryConfigBasedPreferencesProvider.this.createdNodes.add(nuePath);
        }

        return new AuxiliaryConfigBasedPreferences(this, name, nuePath);
    }
}
 
@Override
protected AbstractPreferences getChild(final String nodeName) throws BackingStoreException {
    try {
        return ProjectManager.mutex(false, project).readAccess(new ExceptionAction<AbstractPreferences>() {
            public AbstractPreferences run() throws BackingStoreException {
                return AuxiliaryConfigBasedPreferences.super.getChild(nodeName);
            }
        });
    } catch (MutexException ex) {
        throw (BackingStoreException) ex.getException();
    }
}
 
源代码11 项目: netbeans   文件: InheritedPreferences.java
@Override
protected AbstractPreferences childSpi(String name) {
    Preferences storedNode = stored != null ? stored.node(name) : null;
    if (storedNode != null) {
        return new InheritedPreferences(null, storedNode);
    } else {
        return null;
    }
}
 
public Preferences getPreferences() {
    synchronized (this) {
        Preferences prefs = useProject ? projectPrefs : globalPrefs;
        // to support tests that don't use editor.mimelookup.impl
        return prefs == null ? AbstractPreferences.systemRoot() : prefs;
    }
}
 
源代码13 项目: netbeans   文件: ProxyPreferences.java
@Override
    protected AbstractPreferences childSpi(String name) {
//        Preferences [] nueDelegates = new Preferences[delegates.length];
//        for(int i = 0; i < delegates.length; i++) {
//            nueDelegates[i] = delegates[i].node(name);
//        }
//        return new ProxyPreferences(name, this, nueDelegates);
        throw new UnsupportedOperationException("Not supported yet."); //NOI18N
    }
 
源代码14 项目: netbeans   文件: ProxyPreferences.java
private void firePrefChange(String key, String newValue) {
    try {
        Method m = AbstractPreferences.class.getDeclaredMethod("enqueuePreferenceChangeEvent", String.class, String.class); //NOI18N
        m.setAccessible(true);
        m.invoke(this, key, newValue);
    } catch (Exception e) {
        LOG.log(Level.WARNING, null, e);
    }
}
 
@Override
protected AbstractPreferences childSpi(String name) {
	AbstractPreferences child = children.get(name);
	if (child == null) {
		child = new MockPreferences(this, name);
		children.put(name, child);
	}
	return child;
}
 
源代码16 项目: knopflerfish.org   文件: MountedPreferences.java
protected AbstractPreferences  childSpi(String name) {
  synchronized(mounts) {
    Preferences mount = mounts.get(name);
    if(mount != null) {
      return new MountedPreferences(this, mount, name);
    }
    if(target != null) {
      return new MountedPreferences(this, target.node(name), name);
    } else {
      MountedPreferences m = new MountedPreferences(this, null, name);
      mount(m, name);
      return m;
    }
  }
}
 
源代码17 项目: knopflerfish.org   文件: OSGiUsersPreferences.java
protected AbstractPreferences  childSpi(String name) {
  synchronized(children) {
    OSGiPreferences child = children.get(name);
    if(child == null) {
      org.osgi.service.prefs.Preferences node = 
        prefsService.getUserPreferences(name);
      
      child = new OSGiPreferences(this, node, name);
      children.put(name, child);
    }
    return child;
  }
}
 
/**
 * FIXME - Pure hack to get around erasure.
 *
 * @return true if removed
 * @throws ReflectiveOperationException
 */
private boolean getIsRemoved(AbstractPreferences abstractPreference) throws ReflectiveOperationException {
  Log.message( abstractPreference.toString() );
  final Method declaredMethod = AbstractPreferences.class.getDeclaredMethod("isRemoved");
  declaredMethod.setAccessible(true);
  Object isRemoved = declaredMethod.invoke(abstractPreference, new Object[]{null});
  return (boolean) isRemoved;
}
 
/**
 * FIXME - Pure hack to get around erasure.
 *
 * @param abstractPreference
 * @return
 * @throws ReflectiveOperationException
 */
private boolean getIsRemoved(AbstractPreferences abstractPreference) throws ReflectiveOperationException {
  Log.message( abstractPreference.toString() );
  final Method declaredMethod = AbstractPreferences.class.getDeclaredMethod("isRemoved");
  declaredMethod.setAccessible(true);
  Object isRemoved = declaredMethod.invoke(abstractPreference, new Object[]{null});
  return (boolean) isRemoved;
}
 
源代码20 项目: pentaho-reporting   文件: BinaryPreferences.java
protected AbstractPreferences childSpi( final String name ) {
  if ( name == null || name.length() == 0 ) {
    throw new IllegalArgumentException();
  }

  return new BinaryPreferences( this, name );
}
 
protected MockPreferences(AbstractPreferences parent, String name) {
	super(parent, name);
}
 
protected MockPreferences(AbstractPreferences parent, String name) {
	super(parent, name);
}
 
源代码23 项目: netbeans   文件: TreeRuleTestBase.java
protected AbstractPreferences childSpi(String name) {
    return new TempPreferences(this, name);
}
 
源代码24 项目: netbeans   文件: HintsPanelLogic.java
@Override
protected AbstractPreferences childSpi(String name) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码25 项目: netbeans   文件: HintsPanelLogic.java
@Override protected AbstractPreferences childSpi(String name) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码26 项目: netbeans   文件: HintTest.java
protected AbstractPreferences childSpi(String name) {
    return new TempPreferences(this, name);
}
 
源代码27 项目: netbeans   文件: HintsPanelLogic.java
@Override
protected AbstractPreferences childSpi(String name) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码28 项目: netbeans   文件: CategorySupport.java
protected AbstractPreferences childSpi(String name) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码29 项目: netbeans   文件: CategorySupport.java
protected AbstractPreferences childSpi(String name) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码30 项目: netbeans   文件: NbPreferences.java
@Override
protected AbstractPreferences childSpi(String name) {
    return new UserPreferences(this, name);
}
 
 类所在包
 同包方法