|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecter.extensions.eof.ERXKeyFilter
public class ERXKeyFilter
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 ...
Nested Class Summary | |
---|---|
static class |
ERXKeyFilter.Base
ERXKeyFilter.Base defines the base rule that is applied to a filter. |
static interface |
ERXKeyFilter.Delegate
ERXKeyFilter.Delegate defines an interface for receiving notifications when your filter is applied to an object graph. |
Constructor Summary | |
---|---|
ERXKeyFilter(ERXKeyFilter.Base base)
Creates a new ERXKeyFilter. |
|
ERXKeyFilter(ERXKeyFilter.Base base,
ERXKeyFilter.Base nextBase)
Creates a new ERXKeyFilter. |
Method Summary | ||
---|---|---|
ERXKeyFilter |
_filterForKey(ERXKey key)
Returns the filter for the given key, or creates a "nextBase" filter if there isn't one. |
|
void |
addMap(ERXKey fromKey,
ERXKey toKey)
Adds a key mapping to this filter. |
|
ERXKeyFilter.Base |
base()
Returns the base rule for this filter. |
|
ERXKeyFilter.Delegate |
delegate()
Returns the filter delegate for this filter. |
|
void |
exclude(ERXKey... keys)
Excludes the given keys from this filter. |
|
com.webobjects.foundation.NSSet<ERXKey> |
excludes()
Returns the set of keys that are explicitly excluded. |
|
boolean |
excludes(ERXKey key)
Returns whether or not the given key is excluded. |
|
static ERXKeyFilter |
filterWithAll()
Shortcut to return a new ERXKeyFilter(All) |
|
static ERXKeyFilter |
filterWithAllRecursive()
Shortcut to return a new ERXKeyFilter(All, All) |
|
static ERXKeyFilter |
filterWithAttributes()
Shortcut to return a new ERXKeyFilter(Attributes) |
|
static ERXKeyFilter |
filterWithAttributesAndToOneRelationships()
Shortcut to return a new ERXKeyFilter(AttributesAndToOneRelationships) |
|
static ERXKeyFilter |
filterWithKeys(ERXKey<?>... keys)
Shortcut to return a new ERXKeyFilter() |
|
static ERXKeyFilter |
filterWithNone()
Shortcut to return a new ERXKeyFilter(None) |
|
void |
include(ERXKey... keys)
Includes the given set of keys in this filter. |
|
ERXKeyFilter |
include(ERXKey key)
Includes the given key in this filter. |
|
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. |
|
com.webobjects.foundation.NSDictionary<ERXKey,ERXKeyFilter> |
includes()
Returns the included keys and the next filters they map to. |
|
boolean |
includes(ERXKey key)
Returns whether or not the given key is included in this filter. |
|
|
keyMap(ERXKey<T> fromKey)
Returns the key that is mapped to from the given input key. |
|
boolean |
lockedRelationship(ERXKey key)
Returns whether or not the given relationship is locked (i.e. |
|
com.webobjects.foundation.NSSet<ERXKey> |
lockedRelationships()
Returns the set of relationships that are locked (i.e. |
|
void |
lockRelationship(ERXKey... keys)
Locks the given relationship on this filter. |
|
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. |
|
ERXKeyFilter.Base |
nextBase()
Returns the base that is used for subkeys of this key by default. |
|
void |
only(ERXKey... keys)
Restricts this filter to only allow the given keys. |
|
ERXKeyFilter |
only(ERXKey key)
Restricts this filter to only allow the given key. |
|
void |
setBase(ERXKeyFilter.Base base)
Sets the base rule. |
|
void |
setDelegate(ERXKeyFilter.Delegate delegate)
Associate a filter delegate with this filter. |
|
ERXKeyFilter |
setNextBase(ERXKeyFilter.Base nextBase)
Sets the base that is used for subkeys of this key by default. |
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ERXKeyFilter(ERXKeyFilter.Base base)
base
- the base rule to applypublic ERXKeyFilter(ERXKeyFilter.Base base, ERXKeyFilter.Base nextBase)
base
- the base rule to applynextBase
- the next base rule to applyMethod Detail |
---|
public void setDelegate(ERXKeyFilter.Delegate delegate)
delegate
- the delegate to associatepublic ERXKeyFilter.Delegate delegate()
public void addMap(ERXKey fromKey, ERXKey toKey)
fromKey
- the key to map fromtoKey
- the key to map topublic <T> ERXKey<T> keyMap(ERXKey<T> fromKey)
T
- the type of the key (which doesn't change)fromKey
- the key to map from
public static ERXKeyFilter filterWithNone()
public static ERXKeyFilter filterWithAttributes()
public static ERXKeyFilter filterWithKeys(ERXKey<?>... keys)
keys
- the keys to include
public static ERXKeyFilter filterWithAttributesAndToOneRelationships()
public static ERXKeyFilter filterWithAll()
public static ERXKeyFilter filterWithAllRecursive()
public ERXKeyFilter.Base base()
public void includeAll()
public void includeAttributes()
public void includeAttributesAndToOneRelationships()
public void includeNone()
public void setBase(ERXKeyFilter.Base base)
base
- the base rulepublic ERXKeyFilter.Base nextBase()
public ERXKeyFilter setNextBase(ERXKeyFilter.Base nextBase)
nextBase
- the base that is used for subkeys of this key by default
public ERXKeyFilter _filterForKey(ERXKey key)
key
- the key to lookup
public com.webobjects.foundation.NSDictionary<ERXKey,ERXKeyFilter> includes()
public com.webobjects.foundation.NSSet<ERXKey> excludes()
public com.webobjects.foundation.NSSet<ERXKey> lockedRelationships()
public void include(ERXKey... keys)
keys
- the keys to includepublic boolean includes(ERXKey key)
key
- the key to lookup
public ERXKeyFilter include(ERXKey key)
key
- the key to include
public boolean excludes(ERXKey key)
key
- the key to lookup
public boolean lockedRelationship(ERXKey key)
key
- the key to lookup
public void lockRelationship(ERXKey... keys)
keys
- the relationships to lockpublic void exclude(ERXKey... keys)
keys
- the keys to excludepublic void only(ERXKey... keys)
keys
- the keys to restrict topublic ERXKeyFilter only(ERXKey key)
key
- the only key to allow
public boolean matches(ERXKey key, ERXKey.Type type)
key
- the key to lookuptype
- the type of the key (if known)
public java.lang.String toString()
toString
in class java.lang.Object
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |