com.netflix.eventbus.spi
Interface SerializableEventFilter

All Superinterfaces:
EventFilter, com.google.common.base.Predicate<java.lang.Object>

public interface SerializableEventFilter
extends EventFilter

An optional feature for a EventFilter which indicates that the event filter can be converted back and forth from a string.
Typically, if the filter is an expression of a language, as defined by com.netflix.eventbus.filter.lang, then it should implement this interface. On the other hand, if the filter is represented as code, implementation of this interface is not required.
Any persistence of an EventFilter will require the filter to implement this interface, else it will not be persisted. Since, the filters created in code will typically be registered by the subscribers themselves, they typically will not need any persistence.
One will notice that this filter only supports converting the object representation to a string and not back as the conversion from arbitrary string is handled by EventFilterCompiler. Such, factory kind of methods are deliberately not provided here so that the filter classes do not have to provide any parsing logic.


Method Summary
 FilterLanguage getFilterLanguage()
          The language in which this filter is expressed.
 java.lang.String serialize()
          Serializes this filter into the filter string in the language specified by getFilterLanguage().
 
Methods inherited from interface com.netflix.eventbus.spi.EventFilter
getLanguage
 
Methods inherited from interface com.google.common.base.Predicate
apply, equals
 

Method Detail

getFilterLanguage

FilterLanguage getFilterLanguage()
The language in which this filter is expressed.

Returns:
the language in which this filter is expressed.

serialize

java.lang.String serialize()
Serializes this filter into the filter string in the language specified by getFilterLanguage().

Specified by:
serialize in interface EventFilter
Returns:
String representation of the filter.