Spec-Zone.ru › OpenJavaFX 8
javafx.beans.binding

Class MapExpression<K,V>

java.lang.Object
  • javafx.beans.binding.MapExpression<K,V>

Type Parameters:

K - the type of the key 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>
A MapExpression is a 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

    All MethodsInstance MethodsAbstract Methods
    Type Property and 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

    • Nested classes/interfaces inherited from interface java.util.Map

      Map.Entry<K,V>
  • Constructor Summary

    Constructors
    Constructor and Description
    MapExpression()
  • Method Summary

    All MethodsStatic MethodsInstance MethodsAbstract MethodsConcrete Methods
    Modifier and Type Method and Description
    StringBinding asString()
    Creates a StringBinding that holds the value of the MapExpression turned into a String.
    void clear()
    boolean containsKey(Object obj)
    boolean containsValue(Object obj)
    abstract ReadOnlyBooleanProperty emptyProperty()
    A boolean property that is true, if the map is empty.
    Set<Map.Entry<K,V>> entrySet()
    V get(Object key)
    int getSize()
    The size of the map
    ObservableMap<K,V> getValue()
    Returns the current value of this ObservableValue
    boolean isEmpty()
    Gets the value of the property empty.
    BooleanBinding isEqualTo(ObservableMap<?,?> other)
    Creates a new BooleanBinding that holds true if this map is equal to another ObservableMap.
    BooleanBinding isNotEqualTo(ObservableMap<?,?> other)
    Creates a new BooleanBinding that holds true if this map is not equal to another ObservableMap.
    BooleanBinding isNotNull()
    Creates a new BooleanBinding that holds true if the wrapped map is not null.
    BooleanBinding isNull()
    Creates a new BooleanBinding that holds true if the wrapped map is null.
    Set<K> keySet()
    static <K,V> MapExpression<K,V> mapExpression(ObservableMapValue<K,V> value)
    Returns a MapExpression that wraps a ObservableMapValue.
    V put(K key, V value)
    void putAll(Map<? extends K,? extends V> elements)
    V remove(Object obj)
    int size()
    abstract ReadOnlyIntegerProperty sizeProperty()
    An integer property that represents the size of the map.
    ObjectBinding<V> valueAt(K key)
    Creates a new ObjectBinding that contains the mapping of the specified key.
    ObjectBinding<V> valueAt(ObservableValue<K> key)
    Creates a new ObjectBinding that contains the mapping of the specified key.
    Collection<V> values()
    • Methods inherited from class java.lang.Object

      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Methods inherited from interface javafx.beans.value.ObservableObjectValue

      get
    • Methods inherited from interface javafx.beans.value.ObservableValue

      addListener, removeListener
    • Methods inherited from interface javafx.beans.Observable

      addListener, removeListener
    • Methods inherited from interface javafx.collections.ObservableMap

      addListener, removeListener
    • Methods inherited from interface java.util.Map

      compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
  • Property Detail

    • size

      public abstract ReadOnlyIntegerProperty sizeProperty
      An integer property that represents the size of the map.

      See Also:

      getSize()

    • empty

      public abstract ReadOnlyBooleanProperty emptyProperty
      A boolean property that is true, if the map is empty.

      See Also:

      isEmpty()

  • Constructor Detail

    • MapExpression

      public MapExpression()
  • Method Detail

    • getValue

      public ObservableMap<K,V> getValue()
      Description copied from interface: ObservableValue
      Returns the current value of this ObservableValue

      Specified by:

      getValue in interface ObservableValue<ObservableMap<K,V>>

      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.

      Parameters:

      value - The source ObservableMapValue

      Returns:

      A MapExpression that wraps the ObservableMapValue if necessary

      Throws:

      NullPointerException - if value is null

    • getSize

      public int getSize()
      The size of the map
    • sizeProperty

      public abstract ReadOnlyIntegerProperty sizeProperty()
      An integer property that represents the size of the map.

      See Also:

      getSize()

    • emptyProperty

      public abstract ReadOnlyBooleanProperty emptyProperty()
      A boolean property that is true, if the map is empty.

      See Also:

      isEmpty()

    • 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 - if key is null

    • isEqualTo

      public BooleanBinding isEqualTo(ObservableMap<?,?> other)
      Creates a new BooleanBinding that holds true if this map is equal to another ObservableMap.

      Parameters:

      other - the other ObservableMap

      Returns:

      the new BooleanBinding

      Throws:

      NullPointerException - if other is null

    • isNotEqualTo

      public BooleanBinding isNotEqualTo(ObservableMap<?,?> other)
      Creates a new BooleanBinding that holds true if this map is not equal to another ObservableMap.

      Parameters:

      other - the other ObservableMap

      Returns:

      the new BooleanBinding

      Throws:

      NullPointerException - if other is null

    • isNull

      public BooleanBinding isNull()
      Creates a new BooleanBinding that holds true if the wrapped map is null.

      Returns:

      the new BooleanBinding

    • isNotNull

      public BooleanBinding isNotNull()
      Creates a new BooleanBinding that holds true if the wrapped map is not null.

      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:

      size in interface Map<K,V>

    • isEmpty

      public boolean isEmpty()
      Gets the value of the property empty.

      Specified by:

      isEmpty in interface Map<K,V>

      Property description:

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

    • containsKey

      public boolean containsKey(Object obj)

      Specified by:

      containsKey in interface Map<K,V>

    • containsValue

      public boolean containsValue(Object obj)

      Specified by:

      containsValue in interface Map<K,V>

    • put

      public V put(K key,
                   V value)

      Specified by:

      put in interface Map<K,V>

    • remove

      public V remove(Object obj)

      Specified by:

      remove in interface Map<K,V>

    • putAll

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

      Specified by:

      putAll in interface Map<K,V>

    • clear

      public void clear()

      Specified by:

      clear in interface Map<K,V>

    • keySet

      public Set<K> keySet()

      Specified by:

      keySet in interface Map<K,V>

    • values

      public Collection<V> values()

      Specified by:

      values in interface Map<K,V>

    • entrySet

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

      Specified by:

      entrySet in interface Map<K,V>

    • get

      public V get(Object key)

      Specified by:

      get in interface Map<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.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API