RKRouteSet Class Reference
| Inherits from | NSObject |
| Declared in | RKRouteSet.h |
Overview
The RKRouteSet class provides for the storage and retrieval of RKRoute objects. Route objects are added and removed the route set to manipulate the routing table of the application.
Tasks
Adding and Removing Routes
-
– addRoute:Adds a route to the receiver.
-
– addRoutes:Adds all routes from the given array to the receiver. All objects within the given array must be an instance of
RKRouteor else anNSInvalidArgumentExceptionwill be raised. -
– removeRoute:Removes a route from the receiver.
Querying a Route Set
-
– containsRoute:Determines if a given route exists within the receiver.
-
– allRoutesReturns all routes from the receiver in an array.
-
– namedRoutesReturns all named routes from the receiver in an array.
-
– classRoutesReturns all class routes from the receiver in an array.
-
– relationshipRoutesReturns all relationship routes from the receiver in an array.
-
– routeForName:Retrieves a route with the given name.
-
– routeForClass:method:Retrieves a route for the given object class and request method.
-
– routeForRelationship:ofClass:method:Retrieves a route for a given relationship of a class with a given request method.
-
– routesForClass:Retrieves all class routes with a given object class.
-
– routesForObject:Retrieves all object routes for a given object.
-
– routesForRelationship:ofClass:Retrieves all routes for a given relationship name and object class.
-
– routeForObject:method:Retrieves a route for a given object and request method.
Instance Methods
addRoute:
Adds a route to the receiver.
- (void)addRoute:(RKRoute *)routeParameters
- route
The route to be added. @raises NSInvalidArgumentException Raised if the route already exists in the receiver or overlaps an existing name.
Declared In
RKRouteSet.haddRoutes:
Adds all routes from the given array to the receiver. All objects within the given array must be an instance of RKRoute or else an NSInvalidArgumentException will be raised.
- (void)addRoutes:(NSArray *)routesParameters
- routes
An array of
RKRouteobjects to be added to the receiver.
Declared In
RKRouteSet.hallRoutes
Returns all routes from the receiver in an array.
- (NSArray *)allRoutesReturn Value
An array containing all the routes in the receiver.
Declared In
RKRouteSet.hclassRoutes
Returns all class routes from the receiver in an array.
- (NSArray *)classRoutesReturn Value
An array containing all the class routes in the receiver.
Declared In
RKRouteSet.hcontainsRoute:
Determines if a given route exists within the receiver.
- (BOOL)containsRoute:(RKRoute *)routeParameters
- route
The route to be tested for containement.
Return Value
YES if the route is contained within the route set, else NO.
Declared In
RKRouteSet.hnamedRoutes
Returns all named routes from the receiver in an array.
- (NSArray *)namedRoutesReturn Value
An array containing all the named routes in the receiver.
Declared In
RKRouteSet.hrelationshipRoutes
Returns all relationship routes from the receiver in an array.
- (NSArray *)relationshipRoutesReturn Value
An array containing all the relationship routes in the receiver.
Declared In
RKRouteSet.hremoveRoute:
Removes a route from the receiver.
- (void)removeRoute:(RKRoute *)routeParameters
- route
The route to be removed. @raises NSInvalidArgumentException Raised if the route does not exist in the receiver.
Declared In
RKRouteSet.hrouteForClass:method:
Retrieves a route for the given object class and request method.
- (RKRoute *)routeForClass:(Class)objectClass method:(RKRequestMethod)methodParameters
- objectClass
The object class of the route to be retrieved.
- method
The request method of the route to be retrieved.
Return Value
A route with the given object class and method or nil if none was found.
Declared In
RKRouteSet.hrouteForName:
Retrieves a route with the given name.
- (RKRoute *)routeForName:(NSString *)nameParameters
- name
The name of the named route to be found.
Return Value
A route with the given name or nil if none was found.
Declared In
RKRouteSet.hrouteForObject:method:
Retrieves a route for a given object and request method.
- (RKRoute *)routeForObject:(id)object method:(RKRequestMethod)methodDiscussion
The object routes are first searched for an exact match with the given object’s class and request method. If no exact match is found for the given request method, but a route is found for the RKRequestMethodAny method, it is returned. If neither are found, the search process begins again and traverses up the inheritance hierarchy.
Declared In
RKRouteSet.hrouteForRelationship:ofClass:method:
Retrieves a route for a given relationship of a class with a given request method.
- (RKRoute *)routeForRelationship:(NSString *)relationship ofClass:(Class)objectClass method:(RKRequestMethod)methodParameters
- relationship
The name of the relationship of the route to be retrieved.
- method
The request method of the route to be retrieved.
Return Value
A route with the given relationship name, object class and method or nil if none was found.
Declared In
RKRouteSet.hroutesForClass:
Retrieves all class routes with a given object class.
- (NSArray *)routesForClass:(Class)objectClassParameters
- objectClass
The object class of the routes to be retrieved.
Return Value
An array containing all class routes with the given class.
Discussion
Class matches are determined by direct comparison of the class objects. The inheritance hierarchy is not consulted.
Declared In
RKRouteSet.hroutesForObject:
Retrieves all object routes for a given object.
- (NSArray *)routesForObject:(id)objectParameters
- object
An object for which all object routes are to be retrieved.
Return Value
An array containing all object routes where the target class is included in the given object’s class hierarchy.
Discussion
All object routes are searched and returned if they target a class or superclass of the given object (using - [NSObject isKindOfClass:]).
Declared In
RKRouteSet.hroutesForRelationship:ofClass:
Retrieves all routes for a given relationship name and object class.
- (NSArray *)routesForRelationship:(NSString *)relationshipName ofClass:(Class)objectClassParameters
- relationshipName
The name of the relationship of the routes to be retrieved.
- objectClass
The object class of the routes to be retrieved.
Return Value
An array containing all relationship routes with the given relationship name and object class.
Declared In
RKRouteSet.h