Module org.jhotdraw8.fxcollection
Interface MapAccessor<T>
- Type Parameters:
T- The value type.
- All Known Subinterfaces:
CompositeMapAccessor<T>,Key<T>,NonNullKey<T>,NonNullMapAccessor<T>,NullableKey<T>
- All Known Implementing Classes:
AbstractKey,NonNullListKey,NonNullObjectKey,NullableObjectKey,SetValueMapAccessor,TransientKey
public interface MapAccessor<T>
A type safe accessor for maps.
Design pattern: Strategy
- Author:
- Werner Randelshofer
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(Map<Key<?>, Object> map) Whether the map contains all keys required by this map accessor.@Nullable TGets the value of the attribute denoted by this accessor from a Map.default @Nullable Tget(ReadOnlyMap<? super Key<?>, Object> a) @Nullable TReturns the default value of this map accessor.getName()Returns the name string.Returns the raw value type of this map accessor.Returns the value type of this map accessor.booleanWhether the value needs to be made persistent.@Nullable TPuts the value of the attribute denoted by this accessor from a Map.ImmutableMap<Key<?>, Object> put(ImmutableMap<Key<?>, Object> a, @Nullable T value) Puts the value of the attribute denoted by this accessor from a Map.@Nullable TRemoves the value of the attribute denoted by this accessor from a Map.ImmutableMap<Key<?>, Object> remove(ImmutableMap<Key<?>, Object> a) Removes the value of the attribute denoted by this accessor from a Map.default voidSets the value of the attribute denoted by this accessor from a Map.
-
Method Details
-
containsKey
Whether the map contains all keys required by this map accessor.- Parameters:
map- a map- Returns:
- true if map contains all keys required by this map accessor.
-
getName
String getName()Returns the name string.- Returns:
- name string.
-
get
Gets the value of the attribute denoted by this accessor from a Map.- Parameters:
a- A Map.- Returns:
- The value of the attribute.
-
get
-
put
Puts the value of the attribute denoted by this accessor from a Map.- Parameters:
a- A map.value- The new value. Subclasses may require that the value is non-null.- Returns:
- The old value.
-
put
Puts the value of the attribute denoted by this accessor from a Map.- Parameters:
a- A map.value- The new value. Subclasses may require that the value is non-null.- Returns:
- The updated map.
-
set
Sets the value of the attribute denoted by this accessor from a Map.- Parameters:
a- A map.value- The new value. Subclasses may require that the value is non-null.
-
remove
Removes the value of the attribute denoted by this accessor from a Map.- Parameters:
a- A map.- Returns:
- The old value.
-
remove
Removes the value of the attribute denoted by this accessor from a Map.- Parameters:
a- A map.- Returns:
- The old value.
-
getValueType
Type getValueType()Returns the value type of this map accessor.If the value type has type parameters, make sure to create it using
TypeToken. -
getRawValueType
Returns the raw value type of this map accessor. -
getDefaultValue
@Nullable T getDefaultValue()Returns the default value of this map accessor.The default value of an attribute or property is the value used when that attribute or property is not specified.
- Returns:
- the default value
-
isTransient
boolean isTransient()Whether the value needs to be made persistent.- Returns:
- true if transient
-