Package com.mayam.wf.attributes.shared
Class AttributeRangeMap
java.lang.Object
com.mayam.wf.attributes.shared.AttributeRangeMap
- All Implemented Interfaces:
Copyable
,Serializable
Map from
Attribute
to a pair of values representing the
start and the end of a range. Optionally, each attribute range
may be specified to include null values.
When properly injected, the map will validate input to make sure
it conforms to Attribute
annotations.- Author:
- Markus MÃ¥rtensson
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Describes a class containing anAttributeRangeMap
.static class
Nested classes/interfaces inherited from interface com.mayam.wf.attributes.shared.Copyable
Copyable.Utilities
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all values from the map.boolean
containsAttribute
(@NonNull Attribute attribute) copy()
Creates a full copy of the map.@NonNull AttributeRangeMap
copy
(@NonNull Collection<Attribute> attributes) Creates a partial copy of the map, including only the provided collection of attributes.boolean
@Nullable AttributeRangeMap.Range
getAttributeRange
(@NonNull Attribute attribute) Gets the range for a givenAttribute
.@Nullable AttributeRangeMap.Range
getAttributeRangebyFieldId
(@NonNull String fieldId) Gets the range for a given field identifier.@NonNull AttributeManager
Returns an AttributeManager which manages only the end values of this map.@NonNull AttributeManager
Returns an AttributeManager which manages only the start values of this map.int
hashCode()
boolean
Checks for the existence ofAttributeValidator
helper instance.void
injectHelpers
(AttributeValidator validator, AttributeFieldMapper attributeFieldMapper) Injects helper objects.static @Nullable AttributeRangeMap
merge
(@Nullable AttributeRangeMap original, @Nullable AttributeRangeMap overrides) Merges two AttributeRangeMap objects with priority given to the one referred to as "overrides".void
putAll
(@NonNull AttributeRangeMap other) void
@NonNull AttributeRangeMap
setAttributeRange
(@NonNull Attribute attribute, @Nullable Object start, @Nullable Object end) Sets the range for a givenAttribute
.@NonNull AttributeRangeMap
setAttributeRange
(@NonNull Attribute attribute, @Nullable Object start, @Nullable Object end, boolean includeNulls) Sets the range for a givenAttribute
.@NonNull AttributeRangeMap
setAttributeRangeByFieldId
(@NonNull String fieldId, @Nullable Object start, @Nullable Object end) Sets the range for a given a field identifier.setAttributeRangeByFieldId
(@NonNull String fieldId, @Nullable Object start, @Nullable Object end, boolean includeNulls) Sets the range for a given a field identifier.
-
Field Details
-
validator
-
-
Constructor Details
-
AttributeRangeMap
public AttributeRangeMap()
-
-
Method Details
-
hasInjectedHelpers
public boolean hasInjectedHelpers()Checks for the existence ofAttributeValidator
helper instance.- Returns:
- true if the helper is injected.
-
hashCode
public int hashCode() -
equals
-
setAttributeRangeByFieldId
public @NonNull AttributeRangeMap setAttributeRangeByFieldId(@NonNull String fieldId, @Nullable Object start, @Nullable Object end) Sets the range for a given a field identifier. Null values are not considered part of the range. Requires aAttributeFieldMapper
implementation, which is typically only bound on the server side.- Parameters:
fieldId
- the field identifier.start
- the start of the range.end
- the end of the range.- Returns:
- the map to allow method chaining.
-
setAttributeRangeByFieldId
public AttributeRangeMap setAttributeRangeByFieldId(@NonNull String fieldId, @Nullable Object start, @Nullable Object end, boolean includeNulls) Sets the range for a given a field identifier. Null values are not considered part of the range. Requires aAttributeFieldMapper
implementation, which is typically only bound on the server side.- Parameters:
fieldId
- the field identifier.start
- the start of the range.end
- the end of the range.includeNulls
- if true, nulls are considered part of the range.- Returns:
- the map to allow method chaining.
-
getAttributeRangebyFieldId
Gets the range for a given field identifier. Requires aAttributeFieldMapper
implementation, which is typically only bound on the server side.- Parameters:
fieldId
- the field identifier.- Returns:
- the range as a tuple of start and end value.
-
clear
public void clear()Removes all values from the map. -
getAttributeSet
-
copy
Creates a full copy of the map. -
copy
Creates a partial copy of the map, including only the provided collection of attributes.- Returns:
- new map.
-
getStartManager
Returns an AttributeManager which manages only the start values of this map. -
getEndManager
Returns an AttributeManager which manages only the end values of this map.