- All Known Subinterfaces:
StyleablePropertyBean
- All Known Implementing Classes:
AbstractPropertyBean,AbstractStyleablePropertyBean,SimplePropertyBean
public interface PropertyBean
Interface for beans which support an open number of properties in a
property map.
A property can be accessed using a Key. The type parameter
of the key is used to ensure that property accesses are type safe.
To implement this interface, you need to implement method
getProperties() as shown below.
public class MyBean implements PropertyBean {
protected final ObservableMap<Key<?>, Object> properties = FXCollections.observableMap(new LinkedHashMap<>());
{@literal @}Override
public ObservableMap{@literal <Key<?>, Object>} getProperties() {
return properties;
}
}
- Author:
- Werner Randelshofer
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> @Nullable Tget(MapAccessor<T> key) Gets a property value.default <T> TgetNonNull(NonNullMapAccessor<T> key) Gets a nonnull property value.Returns an observable map of property keys and their values.default <T> javafx.beans.property.ObjectProperty<T> getProperty(Key<T> key) default <T> @Nullable Tput(MapAccessor<T> key, @Nullable T newValue) Puts a property value.default <T> @Nullable TRemoves a property value.default <T> voidset(MapAccessor<T> key, @Nullable T newValue) Sets a property value.default <T> voidsetNonNull(NonNullMapAccessor<T> key, T newValue) Sets a non-null property value.default <T> javafx.beans.value.ObservableValue<T>
-
Method Details
-
getProperties
Returns an observable map of property keys and their values.- Returns:
- the map
-
getProperty
-
set
Sets a property value.- Type Parameters:
T- the value type- Parameters:
key- the keynewValue- the value
-
setNonNull
Sets a non-null property value.- Type Parameters:
T- the value type- Parameters:
key- the keynewValue- the value
-
put
Puts a property value.- Type Parameters:
T- the value type- Parameters:
key- the keynewValue- the value- Returns:
- the old value
-
get
Gets a property value.- Type Parameters:
T- the value type- Parameters:
key- the key- Returns:
- the value
-
getNonNull
Gets a nonnull property value.- Type Parameters:
T- the value type- Parameters:
key- the key- Returns:
- the value
-
remove
Removes a property value.- Type Parameters:
T- the value type- Parameters:
key- the key- Returns:
- the removed value
-
valueAt
-