V
- value typepublic final class NullableClientProperty<V extends Serializable> extends Object implements Serializable
JComponent
.
It is used to decorate JComponent.getClientProperty(Object)
and JComponent.putClientProperty(Object, Object)
methods.
It also contains a null
-able default value that will be returned when JComponent
doesn't have property defined.Constructor and Description |
---|
NullableClientProperty(String key,
V defaultValue)
Constructs new
NullableClientProperty . |
Modifier and Type | Method and Description |
---|---|
V |
defaultValue()
Returns
NullableClientProperty default value. |
V |
get(JComponent component)
Returns
NullableClientProperty value for the specified JComponent . |
String |
key()
Returns
NullableClientProperty key. |
V |
reset(JComponent component)
|
V |
set(JComponent component,
V value)
Updates
NullableClientProperty value in the specified JComponent . |
public NullableClientProperty(@NotNull String key, @Nullable V defaultValue)
NullableClientProperty
.key
- NullableClientProperty
keydefaultValue
- NullableClientProperty
default value@NotNull public String key()
NullableClientProperty
key.NullableClientProperty
key@Nullable public V defaultValue()
NullableClientProperty
default value.NullableClientProperty
default value@Nullable public V get(@NotNull JComponent component)
NullableClientProperty
value for the specified JComponent
.component
- JComponent
to retrieve value forNullableClientProperty
value for the specified JComponent
@Nullable public V set(@NotNull JComponent component, @Nullable V value)
NullableClientProperty
value in the specified JComponent
.component
- JComponent
to update value forvalue
- new valueNullableClientProperty
value for the specified JComponent
@Nullable public V reset(@NotNull JComponent component)
component
- JComponent
to reset value forNullableClientProperty
value for the specified JComponent
Copyright © 2020. All rights reserved.