public class ERXRestFormat extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
ERXRestFormat.Delegate
An ERXRestFormat.Delegate is one component of an ERXRestFormat and is used to customize an ERXRequestNode
after parsing in the context of reading a request or before writing in the context of a response generation.
|
static class |
ERXRestFormat.NoOpDelegate |
Modifier and Type | Field and Description |
---|---|
static String |
BINARY_PLIST_KEY |
static String |
EMBER_KEY |
static String |
FORM_KEY |
static String |
HTML_KEY |
static String |
JS_KEY |
static String |
JSON_KEY |
static String |
PLIST_KEY |
static String |
RAILS_KEY |
static String |
SPROUTCORE_KEY |
static String |
XML_KEY |
Constructor and Description |
---|
ERXRestFormat(String name,
IERXRestParser parser,
IERXRestWriter writer,
ERXRestFormat.Delegate delegate)
Constructs a new ERXRestFormat.
|
Modifier and Type | Method and Description |
---|---|
static ERXRestFormat |
bplist()
Returns the registered plist format.
|
ERXRestFormat.Delegate |
delegate() |
static ERXRestFormat |
form()
Returns the registered html form format.
|
static ERXRestFormat |
formatNamed(String name) |
static boolean |
hasFormatNamed(String name)
Returns true if there is a format registered with the given name.
|
static ERXRestFormat |
html()
Returns the registered html format.
|
static ERXRestFormat |
json()
Returns the registered json format.
|
String |
name()
Returns the name of this format.
|
ERXRestRequestNode |
parse(IERXRestRequest request,
ERXRestContext context)
Returns a parsed ERXRestRequestNode using this format's parser.
|
ERXRestRequestNode |
parse(String str)
Returns a parsed ERXRestRequestNode using this format's parser.
|
ERXRestRequestNode |
parse(String str,
ERXRestContext context)
Returns a parsed ERXRestRequestNode using this format's parser.
|
IERXRestParser |
parser() |
static ERXRestFormat |
plist()
Returns the registered plist format.
|
static ERXRestFormat |
registerFormatNamed(ERXRestFormat format,
String name) |
static ERXRestFormat |
registerFormatNamed(IERXRestParser parser,
IERXRestWriter writer,
ERXRestFormat.Delegate delegate,
String... names) |
String |
toString() |
String |
toString(EOClassDescription classDescription,
List<?> list,
ERXKeyFilter filter,
ERXRestContext context)
Returns the formatted version of the given list.
|
String |
toString(Object obj)
Returns the formatted version of the given object using a recursive "All" filter and the default rest delegate.
|
String |
toString(Object obj,
ERXKeyFilter filter)
Returns the formatted version of the given object using a recursive "All" filter.
|
String |
toString(Object obj,
ERXKeyFilter filter,
ERXRestContext context)
Returns the formatted version of the given object.
|
String |
toString(Object obj,
ERXRestContext context)
Returns the formatted version of the given object using a recursive "All" filter.
|
IERXRestWriter |
writer() |
static ERXRestFormat |
xml()
Returns the registered xml format.
|
public static final String HTML_KEY
public static final String JSON_KEY
public static final String JS_KEY
public static final String RAILS_KEY
public static final String PLIST_KEY
public static final String SPROUTCORE_KEY
public static final String XML_KEY
public static final String FORM_KEY
public static final String BINARY_PLIST_KEY
public static final String EMBER_KEY
public ERXRestFormat(String name, IERXRestParser parser, IERXRestWriter writer, ERXRestFormat.Delegate delegate)
name
- the name of the formatparser
- the parserwriter
- the writerdelegate
- the delegate to use while parsing and writingpublic static ERXRestFormat form()
public static ERXRestFormat html()
public static ERXRestFormat json()
public static ERXRestFormat plist()
public static ERXRestFormat xml()
public static ERXRestFormat bplist()
public String name()
public IERXRestParser parser()
public IERXRestWriter writer()
public ERXRestFormat.Delegate delegate()
public ERXRestRequestNode parse(String str)
str
- the string to parsepublic ERXRestRequestNode parse(String str, ERXRestContext context)
str
- the string to parsecontext
- the REST contextpublic ERXRestRequestNode parse(IERXRestRequest request, ERXRestContext context)
request
- the requestcontext
- the REST contextpublic String toString(Object obj)
obj
- the object to renderpublic String toString(Object obj, ERXKeyFilter filter)
obj
- the object to renderfilter
- the filter to apply to the objectpublic String toString(Object obj, ERXRestContext context)
obj
- the object to rendercontext
- the REST contextpublic String toString(Object obj, ERXKeyFilter filter, ERXRestContext context)
obj
- the object to renderfilter
- the filter to apply to the objectcontext
- the REST contextpublic String toString(EOClassDescription classDescription, List<?> list, ERXKeyFilter filter, ERXRestContext context)
classDescription
- the class description for the elements of the listlist
- the listfilter
- the filtercontext
- the REST contextpublic static boolean hasFormatNamed(String name)
name
- the name to lookuppublic static ERXRestFormat formatNamed(String name)
public static ERXRestFormat registerFormatNamed(IERXRestParser parser, IERXRestWriter writer, ERXRestFormat.Delegate delegate, String... names)
public static ERXRestFormat registerFormatNamed(ERXRestFormat format, String name)
Copyright © 2002 – 2024 Project Wonder.