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 RKRoute or else an NSInvalidArgumentException will be raised.

  • – removeRoute:

    Removes a route from the receiver.

Querying a Route Set

Instance Methods

addRoute:

Adds a route to the receiver.

- (void)addRoute:(RKRoute *)route

Parameters

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.h

addRoutes:

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 *)routes

Parameters

routes

An array of RKRoute objects to be added to the receiver.

Declared In

RKRouteSet.h

allRoutes

Returns all routes from the receiver in an array.

- (NSArray *)allRoutes

Return Value

An array containing all the routes in the receiver.

Declared In

RKRouteSet.h

classRoutes

Returns all class routes from the receiver in an array.

- (NSArray *)classRoutes

Return Value

An array containing all the class routes in the receiver.

Declared In

RKRouteSet.h

containsRoute:

Determines if a given route exists within the receiver.

- (BOOL)containsRoute:(RKRoute *)route

Parameters

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.h

namedRoutes

Returns all named routes from the receiver in an array.

- (NSArray *)namedRoutes

Return Value

An array containing all the named routes in the receiver.

Declared In

RKRouteSet.h

relationshipRoutes

Returns all relationship routes from the receiver in an array.

- (NSArray *)relationshipRoutes

Return Value

An array containing all the relationship routes in the receiver.

Declared In

RKRouteSet.h

removeRoute:

Removes a route from the receiver.

- (void)removeRoute:(RKRoute *)route

Parameters

route

The route to be removed. @raises NSInvalidArgumentException Raised if the route does not exist in the receiver.

Declared In

RKRouteSet.h

routeForClass:method:

Retrieves a route for the given object class and request method.

- (RKRoute *)routeForClass:(Class)objectClass method:(RKRequestMethod)method

Parameters

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.h

routeForName:

Retrieves a route with the given name.

- (RKRoute *)routeForName:(NSString *)name

Parameters

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.h

routeForObject:method:

Retrieves a route for a given object and request method.

- (RKRoute *)routeForObject:(id)object method:(RKRequestMethod)method

Discussion

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.h

routeForRelationship: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)method

Parameters

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.h

routesForClass:

Retrieves all class routes with a given object class.

- (NSArray *)routesForClass:(Class)objectClass

Parameters

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.h

routesForObject:

Retrieves all object routes for a given object.

- (NSArray *)routesForObject:(id)object

Parameters

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.h

routesForRelationship:ofClass:

Retrieves all routes for a given relationship name and object class.

- (NSArray *)routesForRelationship:(NSString *)relationshipName ofClass:(Class)objectClass

Parameters

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