KeyAssociatedFilter Class |
Namespace: Tangosol.Util.Filter
public class KeyAssociatedFilter : IFilter, IPortableObject
The KeyAssociatedFilter type exposes the following members.
Name | Description | |
---|---|---|
![]() | KeyAssociatedFilter |
Default constructor.
|
![]() | KeyAssociatedFilter(IFilter, Object) |
Construct a key associated filter.
|
Name | Description | |
---|---|---|
![]() | Filter |
Obtain the wrapped IFilter.
|
![]() | HostKey |
Obtain the host key that serves as an associated key for all keys
that the wrapped filter will be applied to.
|
Name | Description | |
---|---|---|
![]() | Equals |
Compare the KeyAssociatedFilter with another object to
determine equality.
(Overrides ObjectEquals(Object).) |
![]() | Evaluate |
Apply the test to the object.
|
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode |
Determine a hash value for the KeyAssociatedFilter object
according to the general object.GetHashCode() contract.
(Overrides ObjectGetHashCode.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ReadExternal |
Restore the contents of a user type instance by reading its state
using the specified IPofReader object.
|
![]() | ToString |
Return a human-readable description for this
KeyAssociatedFilter.
(Overrides ObjectToString.) |
![]() | WriteExternal |
Save the contents of a POF user type instance by writing its
state using the specified IPofWriter object.
|
public Object AssociatedKey { get { return ParentId; } }
public Object AssociatedKey { get { return Id; } }
public object GetAssociatedKey(object key) { if (key is ChildKey) { return ((ChildKey) key).ParentId; } else if (key is ParentKey) { return ((ParentKey) key).Id; } else { return null; } }
ParentKey parentKey = new ParentKey(...); Long parentId = parentKey.Id; // this Filter will be applied to all Child objects in order to fetch // those for which ParentId returns the specified Parent identifier IFilter filterEq = new EqualsFilter("ParentId", parentId); // this Filter will direct the query to the cluster node that // currently owns the Parent object with the given identifier IFilter filterAsc = new KeyAssociatedFilter(filterEq, parentId); // run the optimized query to get the ChildKey objects ICollection colChildKeys = cacheChildren.Keys(filterAsc); // get all the Child objects at once ICollection colChildren = cacheChildren.GetAll(colChildKeys);
cacheChildren.Keys.RemoveAll(colChildKeys);