public class Filter
extends java.lang.Object
Title: Framework Support Library
Description: Defines a simple filter that can contain metacharacters.
EventDispatcher
for distributing events to appropriate Event Consumers
(The dispatcher compares an EventId
of the incoming event with a filter of the consumer).
EventId
-like strings with a specific filter pattern.
Filter has the following format: <Item1>.<Item2>...<Item2>
,
where the Item
can contain alphabetic characters or digits (e.g. event.example.1
).
Also a filter can contain metacharacters.
If a filter does not contain metacharacters, any event id will be compared with the filter
character by character (simply like String.equals(Object)
).
Filter can contain the following metacharacters:
*
- can be placed instead of any item or at the end of any item and matches one or more any characters located
till the end of this item.
event.*.example
- matches event ids like event.first.example
or event.second.example
event.abc*.example
- matches event ids like event.abcxyz.example
or event.abc123.example
event.*
- matches event ids like event.first
or event.second
event.*wrong.first
or event.wro*ng.second
are not allowed).
#
- can be placed at the end of a filter (either instead of a latest item or at the end of a latest item) and
matches zero or more any characters located at the end of an event id.
event.example.#
- matches event ids like event.example.first
or event.example.second.123
event.abc#
- matches event ids like event.abcxyz
or event.abc123.example
event.*
- matches event ids like event.first
or event.second
*
metacharacter (e.g. event.*.first#
).
#
matches any event id.
!
- can be placed at the beginning of any item and matches one or more any characters not equal to characters located
after this metacharacter till the end of this item.
event.!first.example
- matches event ids like event.second.example
or event.third.example
event.!first.!example
- matches event ids like event.second.abc
or event.third.123
*
or #
metacharacters (e.g. event.!abc*.example
or
event.!example#
).
!
metacharacter (so event.!.wrong
is not allowed).
event.!*.wrong
or event.*#.wrong
are not allowed).
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
Constructor and Description |
---|
Filter(java.lang.String from)
Constructs a new filter from the specified string.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasMetacharacters()
Checks if the filter has metacharacters.
|
java.lang.String |
toString()
Returns a string form of the filter.
|
public Filter(java.lang.String from) throws FilterFormatException
from
- the string from which a new filter will be constructed.FilterFormatException
- if the specified string has invalid format.public boolean hasMetacharacters()
true
if the filter has any metacharacter, false
otherwise.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.