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

Properties

allRoutes

@property (nonatomic, readonly, copy) NSArray *allRoutes
Discussion

Returns all routes from the receiver in an array.

Return Value

An array containing all the routes in the receiver.

Declared In

RKRouteSet.h

classRoutes

@property (nonatomic, readonly, copy) NSArray *classRoutes
Discussion

Returns all class routes from the receiver in an array.

Return Value

An array containing all the class routes in the receiver.

Declared In

RKRouteSet.h

namedRoutes

@property (nonatomic, readonly, copy) NSArray *namedRoutes
Discussion

Returns all named routes from the receiver in an array.

Return Value

An array containing all the named routes in the receiver.

Declared In

RKRouteSet.h

relationshipRoutes

@property (nonatomic, readonly, copy) NSArray *relationshipRoutes
Discussion

Returns all relationship routes from the receiver in an array.

Return Value

An array containing all the relationship routes in the receiver.

Declared In

RKRouteSet.h

Instance Methods

addRoute:

- (void)addRoute:(RKRoute *)route
Discussion

Adds a route to the receiver.

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:

- (void)addRoutes:(NSArray *)routes
Discussion

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.

Parameters

routes

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

Declared In

RKRouteSet.h

containsRoute:

- (BOOL)containsRoute:(RKRoute *)route
Discussion

Determines if a given route exists within the receiver.

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

removeRoute:

- (void)removeRoute:(RKRoute *)route
Discussion

Removes a route from the receiver.

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:

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

Retrieves a route for the given object class and request 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:

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

Retrieves a route with the given 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:

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

Retrieves a route for a given object and request method.

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:

- (RKRoute *)routeForRelationship:(NSString *)relationship ofClass:(Class)objectClass method:(RKRequestMethod)method
Discussion

Retrieves a route for a given relationship of a class with a given request 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:

- (NSArray *)routesForClass:(Class)objectClass
Discussion

Retrieves all class routes with a given object class.

Class matches are determined by direct comparison of the class objects. The inheritance hierarchy is not consulted.

Parameters

objectClass

The object class of the routes to be retrieved.

Return Value

An array containing all class routes with the given class.

Declared In

RKRouteSet.h

routesForObject:

- (NSArray *)routesForObject:(id)object
Discussion

Retrieves all object routes for a given object.

All object routes are searched and returned if they target a class or superclass of the given object (using - [NSObject isKindOfClass:]).

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.

Declared In

RKRouteSet.h

routesForRelationship:ofClass:

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

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

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