RequestCondition useful when the type of the request
condition is not known ahead of time, e.g. custom condition. Since this
class is also an implementation of RequestCondition, effectively it
decorates the held request condition and allows it to be combined and compared
with other request conditions in a type and null safe way.
When two RequestConditionHolder instances are combined or compared
with each other, it is expected the conditions they hold are of the same type.
If they are not, a ClassCastException is raised.
| Modifier and Type | Field and Description |
|---|---|
| private final RequestCondition |
| Access | Constructor and Description |
|---|---|
| public | RequestConditionHolder(RequestCondition<?>
the condition to hold, may be requestCondition)nullCreate a new holder to wrap the given request condition. |
| Modifier and Type | Method and Description |
|---|---|
| private void | assertEqualConditionTypes(RequestCondition<?> thisCondition, RequestCondition<?> otherCondition)
Ensure the held request conditions are of the same type. |
| public RequestConditionHolder | combine(RequestConditionHolder
the condition to combine with. other)Implements org. Combine the request conditions held by the two RequestConditionHolder instances after making sure the conditions are of the same type. |
| public int | compareTo(RequestConditionHolder other, HttpServletRequest request)
Implements org. Compare the request conditions held by the two RequestConditionHolder instances after making sure the conditions are of the same type. |
| public RequestCondition | |
| protected Collection | getContent()
Implements abstract org. Return the discrete items a request condition is composed of. |
| public RequestConditionHolder | getMatchingCondition(HttpServletRequest request)
Implements org. Get the matching condition for the held request condition wrap it in a new RequestConditionHolder instance. |
| protected String | getToStringInfix()
Implements abstract org. The notation to use when printing discrete items of content. |
| condition | back to summary |
|---|---|
| private final RequestCondition<Object> condition
| |
| RequestConditionHolder | back to summary |
|---|---|
| public RequestConditionHolder(RequestCondition<?> requestCondition) Create a new holder to wrap the given request condition.
| |
| assertEqualConditionTypes | back to summary |
|---|---|
| private void assertEqualConditionTypes(RequestCondition<?> thisCondition, RequestCondition<?> otherCondition) Ensure the held request conditions are of the same type. | |
| combine | back to summary |
|---|---|
| public RequestConditionHolder combine(RequestConditionHolder other) Implements org. Combine the request conditions held by the two RequestConditionHolder instances after making sure the conditions are of the same type. Or if one holder is empty, the other holder is returned.
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(RequestConditionHolder other, HttpServletRequest request) Implements org. Compare the request conditions held by the two RequestConditionHolder instances after making sure the conditions are of the same type. Or if one holder is empty, the other holder is preferred.
| |
| getCondition | back to summary |
|---|---|
| public RequestCondition Return the held request condition, or
| |
| getContent | back to summary |
|---|---|
| protected Collection Implements abstract org. Doc from org. Return the discrete items a request condition is composed of. For example URL patterns, HTTP request methods, param expressions, etc.
| |
| getMatchingCondition | back to summary |
|---|---|
| public RequestConditionHolder getMatchingCondition(HttpServletRequest request) Implements org. Get the matching condition for the held request condition wrap it in a new RequestConditionHolder instance. Or otherwise if this is an empty holder, return the same holder instance.
| |
| getToStringInfix | back to summary |
|---|---|
| protected String getToStringInfix() Implements abstract org. Doc from org. The notation to use when printing discrete items of content. For example
| |