Class EntityTagMatcher
- java.lang.Object
-
- org.eclipse.ditto.model.base.headers.entitytag.EntityTagMatcher
-
@Immutable public final class EntityTagMatcher extends Object
Compares twoentity-tags
if not anASTERISK_INSTANCE
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EntityTagMatcher
asterisk()
boolean
equals(Object o)
static EntityTagMatcher
fromString(String entityTagMatcher)
Builds anEntityTagMatcher
from a String value.int
hashCode()
boolean
isAsterisk()
Indicates whether this entity-tag equals "*".static boolean
isValid(CharSequence entityTagMatcher)
Checks if the given char sequence in terms of being a validEntityTagMatcher
boolean
strongMatch(EntityTag entityTagToMatch)
Matches thisEntityTagMatcher
to the givenentityTagToMatch
.String
toString()
boolean
weakMatch(EntityTag entityTagToMatch)
Matches thisEntityTagMatcher
to the givenentityTagToMatch
.
-
-
-
Method Detail
-
fromString
public static EntityTagMatcher fromString(String entityTagMatcher)
Builds anEntityTagMatcher
from a String value.- Parameters:
entityTagMatcher
- the string representation of the entity-tag-matcher.- Returns:
- the EntityTagMatcher built from the given string value.
- Throws:
NullPointerException
- ifEntityTagMatcher
isnull
.DittoHeaderInvalidException
- if the givenentityTagMatcher
is not valid according toisValid(CharSequence)
.
-
asterisk
public static EntityTagMatcher asterisk()
- Returns:
- the
*
entity-tag value.
-
isValid
public static boolean isValid(@Nullable CharSequence entityTagMatcher)
Checks if the given char sequence in terms of being a validEntityTagMatcher
- Parameters:
entityTagMatcher
- the char sequence to validate.- Returns:
true
if the given entity tag matcher is valid,false
else.
-
strongMatch
public boolean strongMatch(EntityTag entityTagToMatch)
Matches thisEntityTagMatcher
to the givenentityTagToMatch
.- Parameters:
entityTagToMatch
- TheEntityTag
to match against.- Returns:
- always
true
if this instance isisAsterisk
. Else returns result ofstrong comparison between two entity-tags
.
-
weakMatch
public boolean weakMatch(EntityTag entityTagToMatch)
Matches thisEntityTagMatcher
to the givenentityTagToMatch
.- Parameters:
entityTagToMatch
- TheEntityTag
to match against.- Returns:
- Always true if this instance is
isAsterisk
. Else returns result ofEntityTag.weakCompareTo(EntityTag)
weak comparison between two entity-tags}.
-
isAsterisk
public boolean isAsterisk()
Indicates whether this entity-tag equals "*".- Returns:
true
if entity-tag is an asterisk,false
else.
-
-