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

org.eclipse.core.runtime.preferences.IPreferenceMetadataStore Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2020 ArSysOp and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     Alexander Fedorov  - Initial API and implementation
 *******************************************************************************/
package org.eclipse.core.runtime.preferences;

/**
 * Provides metadata-based access to a preference store.
 *
 * @since 3.8
 */
public interface IPreferenceMetadataStore {

	/**
	 * Checks if this value type can be handled by this preference store.
	 *
	 * @param  the value type for the preference
	 * @param valueType the value type to be checked
	 *
	 * @return true if this value type can be handled by this preference store and false otherwise
	 */
	 boolean handles(Class valueType);

	/**
	 * Loads the value of specified preference from an enclosed storage.
	 * If the value is not found returns the preference default value.
	 *
	 * @param  the value type for the preference
	 * @param preference the preference metadata, must not be null.
	 *
	 * @return the preference value or default value if preference is unknown
	 * @throws UnsupportedOperationException for unsupported preference value types
	 *
	 * @see #handles(Class)
	 * @see PreferenceMetadata
	 */
	 V load(PreferenceMetadata preference);

	/**
	 * Saves the value of specified preference to the enclosed storage.
	 *
	 * @param  the value type for the preference
	 * @param value to be saved, must not be null.
	 * @param preference the preference metadata, must not be null.
	 *
	 * @throws UnsupportedOperationException for unsupported preference value types
	 *
	 * @see #handles(Class)
	 * @see PreferenceMetadata
	 */
	 void save(V value, PreferenceMetadata preference);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy