APIdia Launch Partner
Top Description Constructors Methods
javafx.beans.binding

public abstract Class MapExpression<K, V>

extends Object
implements ObservableMapValue<K, V>
Class Inheritance
All Implemented Interfaces
javafx.beans.value.ObservableMapValue, javafx.collections.ObservableMap, javafx.beans.Observable, java.util.Map, javafx.beans.value.ObservableObjectValue, javafx.beans.value.ObservableValue
Known Direct Subclasses
javafx.beans.property.ReadOnlyMapProperty, javafx.beans.binding.MapBinding
Type Parameters
<K>
the type of the key elements
<V>
the type of the value elements
Imports
com.sun.javafx.binding.StringFormatter, javafx.beans.property.ReadOnlyBooleanProperty, .ReadOnlyIntegerProperty, javafx.beans.value.ObservableMapValue, .ObservableValue, javafx.collections.FXCollections, .ObservableList, .ObservableMap, java.util.*

MapExpression is an javafx.beans.value.ObservableMapValue plus additional convenience methods to generate bindings in a fluent style.

A concrete sub-class of MapExpression has to implement the method javafx.beans.value.ObservableMapValue#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

Constructor Summary

AccessConstructor and Description
public
MapExpression()

Creates a default MapExpression.

Method Summary

Modifier and TypeMethod and Description
public StringBinding

Returns:

the new StringBinding
asString
()

Creates a javafx.beans.binding.StringBinding that holds the value of the MapExpression turned into a String.

public void
clear()

Implements java.util.Map.clear.

Removes all of the mappings from this map (optional operation).

public boolean
containsKey(Object obj)

Implements java.util.Map.containsKey.

Returns true if this map contains a mapping for the specified key.

public boolean
containsValue(Object obj)

Implements java.util.Map.containsValue.

Returns true if this map maps one or more keys to the specified value.

public abstract ReadOnlyBooleanProperty

Returns:

the ReadOnlyBooleanProperty
emptyProperty
()

A boolean property that is true, if the map is empty.

public Set<Map.Entry<K, V>>
entrySet()

Implements java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map.

public V
get(Object key)

Implements java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

private ObservableMap<K, V>
public int

Returns:

the size
getSize
()

The size of the map

public ObservableMap<K, V>
getValue()

Implements javafx.beans.value.ObservableValue.getValue.

Returns the current value of this ObservableValue

public boolean
isEmpty()

Implements java.util.Map.isEmpty.

Returns true if this map contains no key-value mappings.

public BooleanBinding

Returns:

the new BooleanBinding
isEqualTo
(final ObservableMap<?, ?>
the other ObservableMap
other
)

Creates a new BooleanBinding that holds true if this map is equal to another javafx.collections.ObservableMap.

public BooleanBinding

Returns:

the new BooleanBinding
isNotEqualTo
(final ObservableMap<?, ?>
the other ObservableMap
other
)

Creates a new BooleanBinding that holds true if this map is not equal to another javafx.collections.ObservableMap.

public BooleanBinding

Returns:

the new BooleanBinding
isNotNull
()

Creates a new BooleanBinding that holds true if the wrapped map is not null.

public BooleanBinding

Returns:

the new BooleanBinding
isNull
()

Creates a new BooleanBinding that holds true if the wrapped map is null.

public Set<K>
keySet()

Implements java.util.Map.keySet.

Returns a Set view of the keys contained in this map.

public static <
the type of the key elements
K
,
the type of the value elements
V
>
MapExpression<K, V>

Returns:

A MapExpression that wraps the ObservableMapValue if necessary
mapExpression
(final ObservableMapValue<K, V>
The source ObservableMapValue
value
)

Returns a MapExpression that wraps a javafx.beans.value.ObservableMapValue.

public V
put(K key, V value)

Implements java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation).

public void
putAll(Map<? extends K, ? extends V> elements)

Implements java.util.Map.putAll.

Copies all of the mappings from the specified map to this map (optional operation).

public V
remove(Object obj)

Implements java.util.Map.remove.

Removes the mapping for a key from this map if it is present (optional operation).

public int
size()

Implements java.util.Map.size.

Returns the number of key-value mappings in this map.

public abstract ReadOnlyIntegerProperty

Returns:

the property
sizeProperty
()

An integer property that represents the size of the map.

public ObjectBinding<V>

Returns:

the ObjectBinding
valueAt
(K
the key of the mapping
key
)

Creates a new ObjectBinding that contains the mapping of the specified key.

public ObjectBinding<V>

Returns:

the ObjectBinding
valueAt
(ObservableValue<K>
the key of the mapping
key
)

Creates a new ObjectBinding that contains the mapping of the specified key.

public Collection<V>
values()

Implements java.util.Map.values.

Returns a Collection view of the values contained in this map.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MapExpressionback to summary
public MapExpression()

Creates a default MapExpression.

Method Detail

asStringback to summary
public StringBinding asString()

Creates a javafx.beans.binding.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:StringBinding

the new StringBinding

clearback to summary
public void clear()

Implements java.util.Map.clear.

Doc from java.util.Map.clear.

Removes all of the mappings from this map (optional operation). The map will be empty after this call returns.

Annotations
@Override
containsKeyback to summary
public boolean containsKey(Object obj)

Implements java.util.Map.containsKey.

Doc from java.util.Map.containsKey.

Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that Objects.equals(key, k). (There can be at most one such mapping.)

Annotations
@Override
containsValueback to summary
public boolean containsValue(Object obj)

Implements java.util.Map.containsValue.

Doc from java.util.Map.containsValue.

Returns true if this map maps one or more keys to the specified value. More formally, returns true if and only if this map contains at least one mapping to a value v such that Objects.equals(value, v). This operation will probably require time linear in the map size for most implementations of the Map interface.

Annotations
@Override
emptyPropertyback to summary
public abstract ReadOnlyBooleanProperty emptyProperty()

A boolean property that is true, if the map is empty.

Returns:ReadOnlyBooleanProperty

the ReadOnlyBooleanProperty

entrySetback to summary
public Set<Map.Entry<K, V>> entrySet()

Implements java.util.Map.entrySet.

Doc from java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation, or through the setValue operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.

Annotations
@Override
getback to summary
public V get(Object key)

Implements java.util.Map.get.

Doc from java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

More formally, if this map contains a mapping from a key k to a value v such that Objects.equals(key, k), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

If this map permits null values, then a return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

Annotations
@Override
getNonNullback to summary
private ObservableMap<K, V> getNonNull()
getSizeback to summary
public int getSize()

The size of the map

Returns:int

the size

getValueback to summary
public ObservableMap<K, V> getValue()

Implements javafx.beans.value.ObservableValue.getValue.

Doc from javafx.beans.value.ObservableValue.getValue.

Returns the current value of this ObservableValue

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Implements java.util.Map.isEmpty.

Doc from java.util.Map.isEmpty.

Returns true if this map contains no key-value mappings.

Annotations
@Override
isEqualToback to summary
public BooleanBinding isEqualTo(final ObservableMap<?, ?> other)

Creates a new BooleanBinding that holds true if this map is equal to another javafx.collections.ObservableMap.

Parameters
other:ObservableMap<?, ?>

the other ObservableMap

Returns:BooleanBinding

the new BooleanBinding

Exceptions
NullPointerException:
if other is null
isNotEqualToback to summary
public BooleanBinding isNotEqualTo(final ObservableMap<?, ?> other)

Creates a new BooleanBinding that holds true if this map is not equal to another javafx.collections.ObservableMap.

Parameters
other:ObservableMap<?, ?>

the other ObservableMap

Returns:BooleanBinding

the new BooleanBinding

Exceptions
NullPointerException:
if other is null
isNotNullback to summary
public BooleanBinding isNotNull()

Creates a new BooleanBinding that holds true if the wrapped map is not null.

Returns:BooleanBinding

the new BooleanBinding

isNullback to summary
public BooleanBinding isNull()

Creates a new BooleanBinding that holds true if the wrapped map is null.

Returns:BooleanBinding

the new BooleanBinding

keySetback to summary
public Set<K> keySet()

Implements java.util.Map.keySet.

Doc from java.util.Map.keySet.

Returns a Set view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.

Annotations
@Override
mapExpressionback to summary
public static <K, V> MapExpression<K, V> mapExpression(final ObservableMapValue<K, V> value)

Returns a MapExpression that wraps a javafx.beans.value.ObservableMapValue. If the ObservableMapValue is already a MapExpression, it will be returned. Otherwise a new javafx.beans.binding.MapBinding is created that is bound to the ObservableMapValue.

Parameters
<K>
the type of the key elements
<V>
the type of the value elements
value:ObservableMapValue<K, V>

The source ObservableMapValue

Returns:MapExpression<K, V>

A MapExpression that wraps the ObservableMapValue if necessary

Exceptions
NullPointerException:
if value is null
putback to summary
public V put(K key, V value)

Implements java.util.Map.put.

Doc from java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)

Annotations
@Override
putAllback to summary
public void putAll(Map<? extends K, ? extends V> elements)

Implements java.util.Map.putAll.

Doc from java.util.Map.putAll.

Copies all of the mappings from the specified map to this map (optional operation). The effect of this call is equivalent to that of calling put(k, v) on this map once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress. If the specified map has a defined encounter order, processing of its mappings generally occurs in that order.

Annotations
@Override
removeback to summary
public V remove(Object obj)

Implements java.util.Map.remove.

Doc from java.util.Map.remove.

Removes the mapping for a key from this map if it is present (optional operation). More formally, if this map contains a mapping from key k to value v such that Objects.equals(key, k), that mapping is removed. (The map can contain at most one such mapping.)

Returns the value to which this map previously associated the key, or null if the map contained no mapping for the key.

If this map permits null values, then a return value of null does not necessarily indicate that the map contained no mapping for the key; it's also possible that the map explicitly mapped the key to null.

The map will not contain a mapping for the specified key once the call returns.

Annotations
@Override
sizeback to summary
public int size()

Implements java.util.Map.size.

Doc from java.util.Map.size.

Returns the number of key-value mappings in this map. If the map contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Annotations
@Override
sizePropertyback to summary
public abstract ReadOnlyIntegerProperty sizeProperty()

An integer property that represents the size of the map.

Returns:ReadOnlyIntegerProperty

the property

valueAtback to summary
public ObjectBinding<V> valueAt(K key)

Creates a new ObjectBinding that contains the mapping of the specified key.

Parameters
key:K

the key of the mapping

Returns:ObjectBinding<V>

the ObjectBinding

valueAtback to summary
public ObjectBinding<V> valueAt(ObservableValue<K> key)

Creates a new ObjectBinding that contains the mapping of the specified key.

Parameters
key:ObservableValue<K>

the key of the mapping

Returns:ObjectBinding<V>

the ObjectBinding

Exceptions
NullPointerException:
if key is null
valuesback to summary
public Collection<V> values()

Implements java.util.Map.values.

Doc from java.util.Map.values.

Returns a Collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Collection.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.

Annotations
@Override