Class MapExpression<K,V>
java.lang.Object
javafx.beans.binding.MapExpression<K,V>
- Type Parameters:
-
K- the type of the key elements -
V- the type of the value elements
- All Implemented Interfaces:
-
Map<K,,V> Observable,ObservableMapValue<K,,V> ObservableObjectValue<ObservableMap<K,,V>> ObservableValue<ObservableMap<K,,V>> ObservableMap<K,V>
- Direct Known Subclasses:
-
MapBinding,ReadOnlyMapProperty
public abstract class MapExpression<K,V> extends Object implements ObservableMapValue<K,V>
MapExpression is an ObservableMapValue plus additional convenience methods to generate bindings in a fluent style. A concrete sub-class of MapExpression has to implement the method ObservableObjectValue.get(), which provides the actual value of this expression.
If the wrapped list of a MapExpression is null, all methods implementing the Map interface will behave as if they were applied to an immutable empty list.
- Since:
- JavaFX 2.1
Property Summary
| Type | Property | Description |
|---|---|---|
abstract ReadOnlyBooleanProperty |
empty |
A boolean property that is true, if the map is empty. |
abstract ReadOnlyIntegerProperty |
size |
An integer property that represents the size of the map. |
Nested Class Summary
Constructor Summary
| Constructor | Description |
|---|---|
MapExpression() |
Creates a default MapExpression. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
StringBinding |
asString() |
|
void |
clear() |
|
boolean |
containsKey |
|
boolean |
containsValue |
|
abstract ReadOnlyBooleanProperty |
emptyProperty() |
A boolean property that is true, if the map is empty. |
Set<Map.Entry<K, |
entrySet() |
|
V |
get |
|
int |
getSize() |
The size of the map |
ObservableMap<K, |
getValue() |
Returns the current value of this ObservableValue
|
boolean |
isEmpty() |
Gets the value of the empty property. |
BooleanBinding |
isEqualTo |
|
BooleanBinding |
isNotEqualTo |
|
BooleanBinding |
isNotNull() |
|
BooleanBinding |
isNull() |
|
Set<K> |
keySet() |
|
static <K, |
mapExpression |
Returns a MapExpression that wraps a ObservableMapValue. |
V |
put |
|
void |
putAll |
|
V |
remove |
|
int |
size() |
|
abstract ReadOnlyIntegerProperty |
sizeProperty() |
An integer property that represents the size of the map. |
ObjectBinding<V> |
valueAt |
Creates a new ObjectBinding that contains the mapping of the specified key. |
ObjectBinding<V> |
valueAt |
Creates a new ObjectBinding that contains the mapping of the specified key. |
Collection<V> |
values() |
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods declared in interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
Methods declared in interface javafx.beans.Observable
addListener, removeListener, subscribe
Methods declared in interface javafx.collections.ObservableMap
addListener, removeListener
Methods declared in interface javafx.beans.value.ObservableObjectValue
get
Methods declared in interface javafx.beans.value.ObservableValue
addListener, flatMap, map, orElse, removeListener, subscribe, subscribe, when
Property Details
size
public abstract ReadOnlyIntegerProperty sizeProperty
An integer property that represents the size of the map.
- See Also:
empty
public abstract ReadOnlyBooleanProperty emptyProperty
A boolean property that is
true, if the map is empty.- See Also:
Constructor Details
MapExpression
public MapExpression()
Creates a default
MapExpression.Method Details
getValue
public ObservableMap<K,V> getValue()
Description copied from interface:
ObservableValueReturns the current value of this
ObservableValue
- Specified by:
-
getValuein interfaceObservableValue<K> - Returns:
- The current value
mapExpression
public static <K, V> MapExpression<K,V> mapExpression(ObservableMapValue<K,V> value)
Returns a
MapExpression that wraps a ObservableMapValue. If the ObservableMapValue is already a MapExpression, it will be returned. Otherwise a new MapBinding is created that is bound to the ObservableMapValue.- Type Parameters:
-
K- the type of the key elements -
V- the type of the value elements - Parameters:
-
value- The sourceObservableMapValue - Returns:
- A
MapExpressionthat wraps theObservableMapValueif necessary - Throws:
-
NullPointerException- ifvalueisnull
getSize
public int getSize()
The size of the map
- Returns:
- the size
sizeProperty
public abstract ReadOnlyIntegerProperty sizeProperty()
An integer property that represents the size of the map.
- Returns:
- the property
- See Also:
emptyProperty
public abstract ReadOnlyBooleanProperty emptyProperty()
A boolean property that is
true, if the map is empty.- Returns:
- the
ReadOnlyBooleanProperty - See Also:
valueAt
public ObjectBinding<V> valueAt(K key)
Creates a new
ObjectBinding that contains the mapping of the specified key.- Parameters:
-
key- the key of the mapping - Returns:
- the
ObjectBinding
valueAt
public ObjectBinding<V> valueAt(ObservableValue<K> key)
Creates a new
ObjectBinding that contains the mapping of the specified key.- Parameters:
-
key- the key of the mapping - Returns:
- the
ObjectBinding - Throws:
-
NullPointerException- ifkeyisnull
isEqualTo
public BooleanBinding isEqualTo(ObservableMap<?,?> other)
- Parameters:
-
other- the otherObservableMap - Returns:
- the new
BooleanBinding - Throws:
-
NullPointerException- ifotherisnull
isNotEqualTo
public BooleanBinding isNotEqualTo(ObservableMap<?,?> other)
- Parameters:
-
other- the otherObservableMap - Returns:
- the new
BooleanBinding - Throws:
-
NullPointerException- ifotherisnull
isNull
public BooleanBinding isNull()
- Returns:
- the new
BooleanBinding
isNotNull
public BooleanBinding isNotNull()
- Returns:
- the new
BooleanBinding
asString
public StringBinding asString()
Creates a
StringBinding that holds the value of the MapExpression turned into a String. If the value of this MapExpression changes, the value of the StringBinding will be updated automatically.- Returns:
- the new
StringBinding
size
public int size()
- Specified by:
-
sizein interfaceMap<K,V>
isEmpty
public boolean isEmpty()
Gets the value of the
empty property.- Specified by:
-
isEmptyin interfaceMap<K,V> - Property description:
- A boolean property that is
true, if the map is empty. - Returns:
- the value of the
emptyproperty - See Also:
containsKey
public boolean containsKey(Object obj)
- Specified by:
-
containsKeyin interfaceMap<K,V>
containsValue
public boolean containsValue(Object obj)
- Specified by:
-
containsValuein interfaceMap<K,V>
put
public V put(K key, V value)
- Specified by:
-
putin interfaceMap<K,V>
remove
public V remove(Object obj)
- Specified by:
-
removein interfaceMap<K,V>
putAll
public void putAll(Map<? extends K,? extends V> elements)
- Specified by:
-
putAllin interfaceMap<K,V>
clear
public void clear()
- Specified by:
-
clearin interfaceMap<K,V>
keySet
public Set<K> keySet()
- Specified by:
-
keySetin interfaceMap<K,V>
values
public Collection<V> values()
- Specified by:
-
valuesin interfaceMap<K,V>
entrySet
public Set<Map.Entry<K,V>> entrySet()
- Specified by:
-
entrySetin interfaceMap<K,V>
get
public V get(Object key)
- Specified by:
-
getin interfaceMap<K,V>
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.