public class Interest<K> extends Object implements InitializingBean
Pattern
,
InterestResultPolicy
,
InitializingBean
,
Constants
Modifier and Type | Class and Description |
---|---|
static class |
Interest.Type
Type of interest registration.
|
Modifier and Type | Field and Description |
---|---|
static String |
ALL_KEYS |
protected static boolean |
DEFAULT_DURABLE |
protected static boolean |
DEFAULT_RECEIVE_VALUES |
protected org.slf4j.Logger |
logger |
Constructor and Description |
---|
Interest(K key)
Constructs an instance of non-durable
Interest initialized with the given key to register interest in,
using the InterestResultPolicy.DEFAULT to initialize the client cache and receiving values by default. |
Interest(K key,
org.apache.geode.cache.InterestResultPolicy policy)
Constructs an instance of non-durable
Interest initialized with the given key to register interest in,
the given InterestResultPolicy used to initialize the client cache, receiving values by default. |
Interest(K key,
org.apache.geode.cache.InterestResultPolicy policy,
boolean durable)
Constructs an instance of
Interest initialized with the given key to register interest in,
the given InterestResultPolicy used to initialize the client cache, the given boolean value
to indicate whether interest registration should be durable, receiving values by default. |
Interest(K key,
org.apache.geode.cache.InterestResultPolicy policy,
boolean durable,
boolean receiveValues)
Constructs an instance of
Interest initialized with the given key to register interest in,
the given InterestResultPolicy used to initialize the client cache and the given boolean values
indicating whether interest registration should be durable and whether to receive values during notifications. |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
Interest |
asType(Interest.Type type)
Builder method to specify the type of interest registration.
|
protected boolean |
containsNonAlphaNumericWhitespace(String value)
Determines whether the given
String value contains at least 1 special character. |
K |
getKey()
Returns the key on which interest is registered.
|
org.apache.geode.cache.InterestResultPolicy |
getPolicy()
Returns the
InterestResultPolicy used when interest is registered and determines whether KEYS,
KEYS_VALUES or nothing (NONE) is initially fetched on initial registration. |
Interest.Type |
getType()
Returns the type of interest registration (e.g. based on KEY or Regex).
|
protected boolean |
isAlphaNumericWhitespace(char character)
Determines whether the given
character is an alphanumeric or whitespace character. |
boolean |
isDurable()
Determines whether the interest registration is durable and persists between cache client sessions.
|
boolean |
isKeyType()
Determines whether this
Interest is a KEY interest registration. |
protected boolean |
isNotAlphaNumericWhitespace(char character)
Determines whether the given
character is a special character (non-alphanumeric, non-whitespace). |
boolean |
isReceiveValues()
Returns the type of values received by the listener.
|
boolean |
isRegexType()
Determines whether this
Interest is a REGEX interest registration. |
protected boolean |
isRegularExpression(Object key)
Determines whether the given
key is a Regular Expression (Regex). |
protected boolean |
isRegularExpression(String value)
Determines whether the given
key is a Regular Expression (Regex). |
Interest |
makeDurable()
Builder method to mark this
Interest as durable. |
static <K> Interest |
newInterest(K key)
Factory method to construct a new instance of
Interest initialized with the given key. |
Interest |
receivesValues(boolean receiveValues)
Builder method to set whether the interest event notifications will receive values along with keys.
|
protected Interest.Type |
resolveType(Interest.Type type)
Attempts to resolve the
Interest.Type based on the configured getKey() . |
void |
setDurable(boolean durable)
Sets whether interest registration is durable and persists between cache client sessions.
|
void |
setKey(K key)
Sets the key on which interest is registered.
|
void |
setPolicy(Object policy)
Sets the initial
InterestResultPolicy used when interest is first registered and determines whether KEYS,
KEYS_VALUE or nothing (NONE) is initially fetched. |
void |
setReceiveValues(boolean receiveValues)
Switches between the different entities received by the listener.
|
void |
setType(Interest.Type type)
Set the type of interest registration (e.g. based on KEY or Regex).
|
String |
toString() |
Interest |
usingPolicy(org.apache.geode.cache.InterestResultPolicy policy)
Builder method to set the
InterestResultPolicy used to initialize the cache. |
Interest |
withKey(K key)
Builder method to express the key of interest.
|
public static final String ALL_KEYS
protected static final boolean DEFAULT_DURABLE
protected static final boolean DEFAULT_RECEIVE_VALUES
protected final org.slf4j.Logger logger
public Interest(K key)
Interest
initialized with the given key to register interest in,
using the InterestResultPolicy.DEFAULT
to initialize the client cache and receiving values by default.key
- key(s) of interest.Interest(Object, InterestResultPolicy, boolean, boolean)
public Interest(K key, org.apache.geode.cache.InterestResultPolicy policy)
Interest
initialized with the given key to register interest in,
the given InterestResultPolicy
used to initialize the client cache, receiving values by default.key
- key(s) of interest.policy
- initial InterestResultPolicy
used to initialize the client cache.Interest(Object, InterestResultPolicy, boolean, boolean)
public Interest(K key, org.apache.geode.cache.InterestResultPolicy policy, boolean durable)
Interest
initialized with the given key to register interest in,
the given InterestResultPolicy
used to initialize the client cache, the given boolean value
to indicate whether interest registration should be durable, receiving values by default.key
- key(s) of interest.policy
- initial InterestResultPolicy
used to initialize the client cache.durable
- boolean value to indicate whether the interest registration should be durable.Interest(Object, InterestResultPolicy, boolean, boolean)
public Interest(K key, org.apache.geode.cache.InterestResultPolicy policy, boolean durable, boolean receiveValues)
Interest
initialized with the given key to register interest in,
the given InterestResultPolicy
used to initialize the client cache and the given boolean values
indicating whether interest registration should be durable and whether to receive values during notifications.key
- key(s) of interest.policy
- initial InterestResultPolicy
used to initialize the client cache.durable
- boolean value to indicate whether the interest registration should be durable.receiveValues
- boolean value to indicate whether to receive value in notifications.Interest(Object, InterestResultPolicy, boolean, boolean)
,
afterPropertiesSet()
public static <K> Interest newInterest(K key)
Interest
initialized with the given key.K
- Class
type of the key.key
- key of interest.Interest
initialized with the given key.Interest(Object)
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
protected Interest.Type resolveType(Interest.Type type)
Interest.Type
based on the configured getKey()
.type
- provided Interest.Type
used if non-null.Interest.Type
.isRegularExpression(Object)
protected boolean isRegularExpression(Object key)
key
is a Regular Expression (Regex).
If the given key
is "ALL_KEYS", a List
or only contains letters, numbers and spaces,
then the key
is not considered a Regular Expression by GemFire, and can be handled with normal
interest registration using Region.registerInterest(Object)
.key
- Object
to evaluate.Object
key
is a Regular Expression.isRegularExpression(String)
protected boolean isRegularExpression(String value)
key
is a Regular Expression (Regex).
If the given value
contains at least 1 special character (e.g. *) and can be compiled
using Pattern.compile(String)
, then the key
is considered a Regular Expression
and interest will be registered using Region.registerInterestRegex(String)
.value
- String
to evaluate.String
value
is a Regular Expression.containsNonAlphaNumericWhitespace(String)
,
Pattern.compile(String)
protected boolean containsNonAlphaNumericWhitespace(String value)
String
value contains at least 1 special character.value
- String
to evaluate.String
contains at least 1 special character,
a non-alphanumeric, non-whitespace character.isAlphaNumericWhitespace(char)
,
isNotAlphaNumericWhitespace(char)
protected boolean isNotAlphaNumericWhitespace(char character)
character
is a special character (non-alphanumeric, non-whitespace).character
- Character
to evaluate.character
is a special character.isAlphaNumericWhitespace(char)
protected boolean isAlphaNumericWhitespace(char character)
character
is an alphanumeric or whitespace character.character
- Character
to evaluate.character
is an alphanumeric
or whitespace character.Character.isDigit(char)
,
Character.isLetter(char)
,
Character.isWhitespace(char)
public boolean isDurable()
public void setDurable(boolean durable)
durable
- boolean value to indicate whether this interest registration is durable.public K getKey()
public void setKey(K key)
key
- the key of interest.public org.apache.geode.cache.InterestResultPolicy getPolicy()
InterestResultPolicy
used when interest is registered and determines whether KEYS,
KEYS_VALUES or nothing (NONE) is initially fetched on initial registration.public void setPolicy(Object policy)
InterestResultPolicy
used when interest is first registered and determines whether KEYS,
KEYS_VALUE or nothing (NONE) is initially fetched.
The argument is set as an Object
to be able to accept both InterestResultPolicy
and Strings
, used in XML configuration meta-data.policy
- initial InterestResultPolicy
to set.IllegalArgumentException
- if the given policy
is not a valid type.InterestResultPolicy
public boolean isReceiveValues()
public void setReceiveValues(boolean receiveValues)
receiveValues
- the receiveValues to setpublic Interest.Type getType()
Interest.Type
determining the type of interest.Interest.Type
public void setType(Interest.Type type)
type
- Interest.Type
qualifying the type of interest.Interest.Type
public boolean isKeyType()
Interest
is a KEY interest registration.Interest.Type.KEY
,
getType()
public boolean isRegexType()
Interest
is a REGEX interest registration.Interest.Type.REGEX
,
getType()
public Interest asType(Interest.Type type)
type
- Interest.Type
of interest registration.Interest
.Interest.Type
,
resolveType(Type)
,
setType(Type)
public Interest makeDurable()
Interest
as durable.Interest
.setDurable(boolean)
public Interest receivesValues(boolean receiveValues)
receiveValues
- boolean to indicate that value should be sent along with keys
on interest event notifications.Interest
.setReceiveValues(boolean)
public Interest usingPolicy(org.apache.geode.cache.InterestResultPolicy policy)
InterestResultPolicy
used to initialize the cache.policy
- InterestResultPolicy
.Interest
.InterestResultPolicy
,
setPolicy(Object)
public Interest withKey(K key)
key
- key of interests.Interest
.setKey(Object)
,
getType()
,
resolveType(Type)
,
setType(Type)
Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.