ERXKeyFilter Class Reference

Collaboration diagram for ERXKeyFilter:

Collaboration graph
[legend]

List of all members.

Classes

interface  Delegate

Public Types

enum  Base { None, Attributes, AttributesAndToOneRelationships, All }

Public Member Functions

ERXKeyFilter _filterForKey (ERXKey key)
void addMap (ERXKey fromKey, ERXKey toKey)
ERXKeyFilter.Base base ()
ERXKeyFilter.Delegate delegate ()
 ERXKeyFilter (ERXKeyFilter.Base base, ERXKeyFilter.Base nextBase)
 ERXKeyFilter (ERXKeyFilter.Base base)
void exclude (ERXKey...keys)
boolean excludes (ERXKey key)
NSSet< ERXKey > excludes ()
ERXKeyFilter include (ERXKey key)
void include (ERXKey...keys)
void includeAll ()
void includeAttributes ()
void includeAttributesAndToOneRelationships ()
void includeNone ()
boolean includes (ERXKey key)
NSDictionary< ERXKey,
ERXKeyFilter
includes ()
boolean lockedRelationship (ERXKey key)
NSSet< ERXKey > lockedRelationships ()
void lockRelationship (ERXKey...keys)
boolean matches (ERXKey key, ERXKey.Type type)
ERXKeyFilter.Base nextBase ()
ERXKeyFilter only (ERXKey key)
void only (ERXKey...keys)
void setBase (ERXKeyFilter.Base base)
void setDelegate (ERXKeyFilter.Delegate delegate)
ERXKeyFilter setNextBase (ERXKeyFilter.Base nextBase)
String toString ()

Static Public Member Functions

static ERXKeyFilter filterWithAll ()
static ERXKeyFilter filterWithAllRecursive ()
static ERXKeyFilter filterWithAttributes ()
static ERXKeyFilter filterWithAttributesAndToOneRelationships ()
static ERXKeyFilter filterWithKeys (ERXKey<?>...keys)
static ERXKeyFilter filterWithNone ()

Package Functions

public< T > ERXKey< T > keyMap (ERXKey< T > fromKey)

Private Attributes

ERXKeyFilter.Base _base
ERXKeyFilter.Delegate _delegate
NSMutableSet< ERXKey > _excludes
NSMutableDictionary< ERXKey,
ERXKeyFilter
_includes
NSMutableSet< ERXKey > _lockedRelationships
NSMutableDictionary< ERXKey,
ERXKey > 
_map
ERXKeyFilter.Base _nextBase


Detailed Description

ERXKeyFilter provides a way to specify hierarchical rules for including and excluding ERXKeys. This is useful if you need to perform operations on a set of EO's and optional relationships and attributes within those EO's. As an example, ERXRest uses ERXKeyFilter to programmatically specify which attributes and relationships will be rendered for a particular root EO.

ERXKeyFilter is a hierarchical mapping between ERXKeys (single key, not keypaths), whether an include or exclude rule should be applied for that key, and if it's an include, the next set of filter rules to apply to the destination object.

 ERXKeyFilter companyFilter = ERXKeyFilter.filterWithAttribtues();
 ERXKeyFilter remindersFilter = companyFilter.include(Company.REMINDERS);
 remindersFilter.include(Reminder.SUMMARY);
 ERXKeyFilter reminderAuthorFilter = remindersFilter.include(Reminder.AUTHOR);
 reminderAuthorFilter.includeAll();
 reminderAuthorFilter.exclude(Author.HUGE_RELATIONSHIP);
 

more method comments to come ...

Author:
mschrag

Member Enumeration Documentation

enum Base

ERXKeyFilter.Base defines the base rule that is applied to a filter.

Author:
mschrag
Enumerator:
None 
Attributes 
AttributesAndToOneRelationships 
All 


Constructor & Destructor Documentation

Creates a new ERXKeyFilter.

Parameters:
base the base rule to apply

Creates a new ERXKeyFilter.

Parameters:
base the base rule to apply
nextBase the next base rule to apply


Member Function Documentation

ERXKeyFilter _filterForKey ( ERXKey  key  ) 

Returns the filter for the given key, or creates a "nextBase" filter if there isn't one. This should usually only be called when you know exactly what you're doing, as this doesn't fully interpret include/exclude rules.

Parameters:
key the key to lookup
Returns:
the key filter

void addMap ( ERXKey  fromKey,
ERXKey  toKey 
)

Adds a key mapping to this filter.

Parameters:
fromKey the key to map from
toKey the key to map to

ERXKeyFilter.Base base (  ) 

Returns the base rule for this filter.

Returns:
the base rule for this filter

ERXKeyFilter.Delegate delegate (  ) 

Returns the filter delegate for this filter.

Returns:
the delegate

void exclude ( ERXKey...  keys  ) 

Excludes the given keys from this filter.

Parameters:
keys the keys to exclude

boolean excludes ( ERXKey  key  ) 

Returns whether or not the given key is excluded.

Parameters:
key the key to lookup
Returns:
whether or not the given key is excluded

NSSet<ERXKey> excludes (  ) 

Returns the set of keys that are explicitly excluded.

Returns:
the set of keys that are explicitly excluded

static ERXKeyFilter filterWithAll (  )  [static]

Shortcut to return a new ERXKeyFilter(All)

Returns:
a new ERXKeyFilter(All)

static ERXKeyFilter filterWithAllRecursive (  )  [static]

Shortcut to return a new ERXKeyFilter(All, All)

Returns:
a new ERXKeyFilter(All, All)

static ERXKeyFilter filterWithAttributes (  )  [static]

Shortcut to return a new ERXKeyFilter(Attributes)

Returns:
a new ERXKeyFilter(Attributes)

static ERXKeyFilter filterWithAttributesAndToOneRelationships (  )  [static]

Shortcut to return a new ERXKeyFilter(AttributesAndToOneRelationships)

Returns:
a new ERXKeyFilter(AttributesAndToOneRelationships)

static ERXKeyFilter filterWithKeys ( ERXKey<?>...  keys  )  [static]

Shortcut to return a new ERXKeyFilter()

Parameters:
keys the keys to include
Returns:
a new ERXKeyFilter(None) with the included keys

static ERXKeyFilter filterWithNone (  )  [static]

Shortcut to return a new ERXKeyFilter(None)

Returns:
a new ERXKeyFilter(None)

ERXKeyFilter include ( ERXKey  key  ) 

Includes the given key in this filter.

Parameters:
key the key to include
Returns:
the next filter

void include ( ERXKey...  keys  ) 

Includes the given set of keys in this filter.

Parameters:
keys the keys to include

void includeAll (  ) 

Sets the base rule to All.

void includeAttributes (  ) 

Sets the base rule to Attributes.

void includeAttributesAndToOneRelationships (  ) 

Sets the base rule to AttribtuesAndToOneRelationships.

void includeNone (  ) 

Sets the base rule to None.

boolean includes ( ERXKey  key  ) 

Returns whether or not the given key is included in this filter.

Parameters:
key the key to lookup
Returns:
whether or not the given key is included in this filter

NSDictionary<ERXKey, ERXKeyFilter> includes (  ) 

Returns the included keys and the next filters they map to.

Returns:
the included keys and the next filters they map to

public<T> ERXKey<T> keyMap ( ERXKey< T >  fromKey  )  [package]

Returns the key that is mapped to from the given input key.

Parameters:
<T> the type of the key (which doesn't change)
fromKey the key to map from
Returns:
the key that maps to the given key

boolean lockedRelationship ( ERXKey  key  ) 

Returns whether or not the given relationship is locked (i.e. value's attributes can be updated but not the relationship cannot be changed).

Parameters:
key the key to lookup
Returns:
whether or not the given relationship is locked

NSSet<ERXKey> lockedRelationships (  ) 

Returns the set of relationships that are locked (i.e. cannot be replaced).

Returns:
the set of relationships that are locked (i.e. cannot be replaced)

void lockRelationship ( ERXKey...  keys  ) 

Locks the given relationship on this filter.

Parameters:
keys the relationships to lock

boolean matches ( ERXKey  key,
ERXKey.Type  type 
)

Returns whether or not the given key (of the given type, if known) is included in this filter.

Parameters:
key the key to lookup
type the type of the key (if known)
Returns:
whether or not this filter matches the key

ERXKeyFilter.Base nextBase (  ) 

Returns the base that is used for subkeys of this key by default.

Returns:
the base that is used for subkeys of this key by default

ERXKeyFilter only ( ERXKey  key  ) 

Restricts this filter to only allow the given key.

Parameters:
key the only key to allow
Returns:
the next filter

void only ( ERXKey...  keys  ) 

Restricts this filter to only allow the given keys.

Parameters:
keys the keys to restrict to

void setBase ( ERXKeyFilter.Base  base  ) 

Sets the base rule.

Parameters:
base the base rule

void setDelegate ( ERXKeyFilter.Delegate  delegate  ) 

Associate a filter delegate with this filter.

Parameters:
delegate the delegate to associate

ERXKeyFilter setNextBase ( ERXKeyFilter.Base  nextBase  ) 

Sets the base that is used for subkeys of this key by default.

Parameters:
nextBase the base that is used for subkeys of this key by default
Returns:
this (for chaining)

String toString (  ) 


Member Data Documentation

ERXKeyFilter.Delegate _delegate [private]

NSMutableSet<ERXKey> _excludes [private]

NSMutableDictionary<ERXKey, ERXKey> _map [private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:11 2012 for Project Wonder by  doxygen 1.5.8