01: /*******************************************************************************
02: * Copyright (c) 2004, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.preferences;
11:
12: import java.util.Set;
13:
14: /**
15: * Eclipse provides many different classes and interfaces that map ids onto values and
16: * send property change notifications (some examples are themes, preference stores,
17: * xml nodes, property providers, and others). This interface is intended to provide
18: * interoperability between these various classes.
19: *
20: * @since 3.1
21: */
22: public interface IPropertyMap {
23:
24: /**
25: * Returns the set of keys that are recognized by this property map
26: * (optional operation).
27: *
28: * @return the set of valid keys for this map
29: * @throws UnsupportedOperationException if this type of property map
30: * cannot compute the set of valid keys
31: * @since 3.1
32: */
33: public Set keySet();
34:
35: /**
36: * Returns the value of the given property. Returns null if the given
37: * property does not exist, cannot be converted into the expected type,
38: * or if the value of the property is null.
39: *
40: * @param propertyId property ID to query
41: * @param propertyType type of the expected return value
42: * @return an object of the given propertyType or null if the property
43: * does not exist or has the wrong type
44: * @since 3.1
45: */
46: public Object getValue(String propertyId, Class propertyType);
47:
48: /**
49: * If this map represents the union of multiple property maps, this
50: * returns true iff the property existed in every map in the union.
51: * Always returns true if this map was not computed from the union
52: * of multiple maps.
53: *
54: * @param propertyId
55: * @return true iff the given property existed in every child map
56: * @since 3.1
57: */
58: public boolean isCommonProperty(String propertyId);
59:
60: /**
61: * Returns true iff the given property exists.
62: *
63: * @param propertyId
64: * @return true iff the given property exists in this map
65: * @since 3.1
66: */
67: public boolean propertyExists(String propertyId);
68:
69: /**
70: * Sets the value of the given property to the given value (optional
71: * operation).
72: *
73: * @param propertyId
74: * @param newValue
75: * @throws UnsupportedOperationException if this type of property map
76: * is read-only
77: * @since 3.1
78: */
79: public void setValue(String propertyId, Object newValue);
80: }
|