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
Modifier 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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all values from the map.boolean
containsAttribute
(Attribute attribute) copy()
Creates a full copy of the map.copy
(Collection<Attribute> attributes) Creates a partial copy of the map, including only the provided collection of attributes.boolean
getAttributeRange
(Attribute attribute) Gets the range for a givenAttribute
.getAttributeRangebyFieldId
(String fieldId) Gets the range for a given field identifier.Returns an AttributeManager which manages only the end values of this map.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 AttributeRangeMap
merge
(AttributeRangeMap original, AttributeRangeMap overrides) Merges two AttributeRangeMap objects with priority given to the one referred to as "overrides".void
putAll
(AttributeRangeMap other) void
setAttributeRange
(Attribute attribute, Object start, Object end) Sets the range for a givenAttribute
.setAttributeRange
(Attribute attribute, Object start, Object end, boolean includeNulls) Sets the range for a givenAttribute
.setAttributeRangeByFieldId
(String fieldId, Object start, Object end) Sets the range for a given a field identifier.setAttributeRangeByFieldId
(String fieldId, Object start, 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
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(String fieldId, Object start, 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.