RKParserRegistry Class Reference
Inherits from | NSObject |
Declared in | RKParserRegistry.h RKParserRegistry.m |
Overview
RKParserRegistry provides for the registration of RKParser classes that handle parsing/serializing for content by MIME Type. Registration is configured via exact string matches (i.e. application/json) or via regular expression.
Tasks
-
+ sharedRegistry
Return the global shared singleton registry for MIME Type to Parsers
-
+ setSharedRegistry:
Sets the global shared registry singleton to a new instance of RKParserRegistry
-
– parserForMIMEType:
Returns an instance of the RKParser conformant class registered to handle content with the given MIME Type.
-
– parserClassForMIMEType:
Returns an instance of the RKParser conformant class registered to handle content with the given MIME Type.
-
– setParserClass:forMIMEType:
Registers an RKParser conformant class as the handler for MIME Types exactly matching the specified MIME Type string.
-
– setParserClass:forMIMETypeRegularExpression:
Registers an RKParser conformant class as the handler for MIME Types matching the specified regular expression.
-
– autoconfigure
Automatically configure the registry via run-time reflection of the RKParser classes available that ship with RestKit. This happens automatically when the shared registry singleton is initialized and makes configuration transparent to users.
Class Methods
Instance Methods
autoconfigure
Automatically configure the registry via run-time reflection of the RKParser classes available that ship with RestKit. This happens automatically when the shared registry singleton is initialized and makes configuration transparent to users.
- (void)autoconfigure
Declared In
RKParserRegistry.h
parserClassForMIMEType:
Returns an instance of the RKParser conformant class registered to handle content with the given MIME Type.
- (Class<RKParser>)parserClassForMIMEType:(NSString *)MIMEType
Parameters
- MIMEType
The MIME Type of the content to be parsed/serialized.
Return Value
The RKParser conformant class registered to handle the given MIME Type.
Discussion
MIME Types are searched in the order in which they are registered and exact string matches are favored over regular expressions.
Declared In
RKParserRegistry.h
parserForMIMEType:
Returns an instance of the RKParser conformant class registered to handle content with the given MIME Type.
- (id<RKParser>)parserForMIMEType:(NSString *)MIMEType
Parameters
- MIMEType
The MIME Type of the content to be parsed/serialized.
Return Value
An instance of the RKParser conformant class registered to handle the given MIME Type.
Discussion
MIME Types are searched in the order in which they are registered and exact string matches are favored over regular expressions.
Declared In
RKParserRegistry.h
setParserClass:forMIMEType:
Registers an RKParser conformant class as the handler for MIME Types exactly matching the specified MIME Type string.
- (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString *)MIMEType
Parameters
- parserClass
The RKParser conformant class to instantiate when parsing/serializing MIME Types matching MIMETypeExpression.
- MIMEType
A MIME Type string for which instances of parserClass should be used for parsing/serialization.
Declared In
RKParserRegistry.h
setParserClass:forMIMETypeRegularExpression:
Registers an RKParser conformant class as the handler for MIME Types matching the specified regular expression.
- (void)setParserClass:(Class<RKParser>)parserClass forMIMETypeRegularExpression:(NSRegularExpression *)MIMETypeRegex
Parameters
- parserClass
The RKParser conformant class to instantiate when parsing/serializing MIME Types matching MIMETypeExpression.
- MIMETypeRegex
A regular expression that matches MIME Types that should be handled by instances of parserClass.
Declared In
RKParserRegistry.h