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

org.scijava.prefs.PrefService Maven / Gradle / Ivy

Go to download

SciJava Common is a shared library for SciJava software. It provides a plugin framework, with an extensible mechanism for service discovery, backed by its own annotation processor, so that plugins can be loaded dynamically. It is used by downstream projects in the SciJava ecosystem, such as ImageJ and SCIFIO.

There is a newer version: 2.99.0
Show newest version
/*
 * #%L
 * SciJava Common shared library for SciJava software.
 * %%
 * Copyright (C) 2009 - 2016 Board of Regents of the University of
 * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck
 * Institute of Molecular Cell Biology and Genetics.
 * %%
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 * #L%
 */

package org.scijava.prefs;

import java.util.List;
import java.util.Map;

import org.scijava.service.SciJavaService;
import org.scijava.service.Service;

/**
 * {@link Service} for storing and retrieving arbitrary preferences.
 *
 * @author Mark Hiner
 */
public interface PrefService extends SciJavaService {

	String get(String name);

	String get(String name, String defaultValue);

	boolean getBoolean(String name, boolean defaultValue);

	double getDouble(String name, double defaultValue);

	float getFloat(String name, float defaultValue);

	int getInt(String name, int defaultValue);

	long getLong(String name, long defaultValue);

	void put(String name, String value);

	void put(String name, boolean value);

	void put(String name, double value);

	void put(String name, float value);

	void put(String name, int value);

	void put(String name, long value);

	String get(Class c, String name);

	String get(Class c, String name, String defaultValue);

	boolean getBoolean(Class c, String name, boolean defaultValue);

	double getDouble(Class c, String name, double defaultValue);

	float getFloat(Class c, String name, float defaultValue);

	int getInt(Class c, String name, int defaultValue);

	long getLong(Class c, String name, long defaultValue);

	void put(Class c, String name, String value);

	void put(Class c, String name, boolean value);

	void put(Class c, String name, double value);

	void put(Class c, String name, float value);

	void put(Class c, String name, int value);

	void put(Class c, String name, long value);

	void clear(Class c);

	/** Clears everything. */
	void clearAll();

	/** Clears the node. */
	void clear(String key);

	/**
	 * Clears the node indexed under the given class.
	 */
	void clear(Class prefClass, String key);

	/**
	 * Clears the ndoe indexed under the given path.
	 */
	void clear(String absolutePath, String key);

	/** Removes the node. */
	void remove(Class prefClass, String key);

	void remove(String absolutePath, String key);

	/** Puts a Map into the preferences. */
	void putMap(Map map, String key);

	/**
	 * Puts a Map into the preferences, indexed under the specified class.
	 */
	void putMap(Class prefClass, Map map, String key);

	/**
	 * Puts a Map into the preferences, indexed under the given path.
	 */
	void putMap(String absolutePath, Map map);

	/**
	 * Puts a Map into the preferences, indexed under the given class.
	 */
	void putMap(Class prefClass, Map map);

	/**
	 * Puts a Map into the preferences, indexed under the given path and
	 * relative key path.
	 */
	void putMap(String absolutePath, Map map, String key);

	/** Gets a Map from the preferences. */
	Map getMap(String key);

	/**
	 * Gets a map from the preferences, indexed under the specified class.
	 */
	Map getMap(Class prefClass, String key);

	/** Gets a Map from the preferences. */
	Map getMap(Class prefClass);

	Map getMap(String absolutePath, String key);

	/** Puts a list into the preferences. */
	void putList(List list, String key);

	/**
	 * Puts a list into the preferences, indexed under the specified class.
	 */
	void putList(Class prefClass, List list, String key);

	/**
	 * Puts a list into the preferences, indexed under the specified path and
	 * relative key.
	 */
	void putList(String absolutePath, List list, String key);

	/** Puts a list into the preferences. */
	void putList(Class prefClass, List list);

	/** Puts a list into the preferences, indexed under the specified path. */
	void putList(String absolutePath, List list);

	/** Gets a List from the preferences. */
	List getList(String key);

	/**
	 * Gets a List from the preferences, indexed under the specified path.
	 */
	List getList(String absolutePath, String key);

	/**
	 * Gets a List from the preferences, indexed under the specified class.
	 */
	List getList(Class prefClass, String key);

	/**
	 * Gets a List from the preferences. Returns an empty list if nothing in
	 * prefs.
	 */
	List getList(Class prefClass);

	/**
	 * Puts an iterable into the preferences.
	 */
	void putIterable(Iterable iterable, String key);

	/**
	 * Puts an iterable into the preferences.
	 */
	void putIterable(Class prefClass, Iterable iterable, String key);

	/**
	 * Gets an iterable from the preferences.
	 */
	Iterable getIterable(String key);

	/**
	 * Gets an iterable from the preferences.
	 */
	Iterable getIterable(Class prefClass, String key);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy