T
- The interface class.public class MockRemoteResource<T> extends Object
Modifier | Constructor and Description |
---|---|
protected |
MockRemoteResource(Class<T> intf,
Object impl)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
MockRemoteResource<T> |
accept(String value)
Adds an
|
T |
build()
Constructs a remote proxy interface based on the settings of this builder.
|
static <T> T |
build(Class<T> intf,
Object impl)
Convenience method for getting a remote resource interface.
|
static <T> T |
build(Class<T> intf,
Object impl,
Marshall m)
Convenience method for getting a remote resource interface.
|
static <T> T |
build(Class<T> intf,
Object impl,
Serializer s,
Parser p)
Convenience method for getting a remote resource interface.
|
MockRemoteResource<T> |
contentType(String value)
Adds a
|
static <T> MockRemoteResource<T> |
create(Class<T> intf,
Object impl)
Create a new builder using the specified remote resource interface and REST implementation bean or bean class.
|
static <T> MockRemoteResource<T> |
create(Class<T> intf,
Object impl,
Marshall m)
Create a new builder using the specified remote resource interface and REST implementation bean or bean class.
|
static <T> MockRemoteResource<T> |
create(Class<T> intf,
Object impl,
Serializer s,
Parser p)
Create a new builder using the specified remote resource interface and REST implementation bean or bean class.
|
MockRemoteResource<T> |
debug()
Enable debug mode.
|
MockRemoteResource<T> |
header(String name,
Object value)
Adds a header to every request.
|
MockRemoteResource<T> |
headers(Map<String,Object> value)
Adds the specified headers to every request.
|
MockRemoteResource<T> |
html()
Convenience method for setting
|
MockRemoteResource<T> |
json()
Convenience method for setting
|
MockRemoteResource<T> |
marshall(Marshall value)
Associates the specified
Marshall with this client. |
MockRemoteResource<T> |
msgpack()
Convenience method for setting
|
MockRemoteResource<T> |
openapi()
Convenience method for setting
|
MockRemoteResource<T> |
parser(Parser value)
Associates the specified
Parser with this client. |
MockRemoteResource<T> |
plainText()
Convenience method for setting
|
MockRemoteResource<T> |
serializer(Serializer value)
Associates the specified
Serializer with this client. |
MockRemoteResource<T> |
simpleJson()
Convenience method for setting
|
MockRemoteResource<T> |
uon()
Convenience method for setting
|
MockRemoteResource<T> |
urlEnc()
Convenience method for setting
|
MockRemoteResource<T> |
xml()
Convenience method for setting
|
protected MockRemoteResource(Class<T> intf, Object impl)
intf
- The remote interface annotated with @RemoteResource
.impl
- The REST implementation bean or bean class annotated with @RestResource
.
public static <T> MockRemoteResource<T> create(Class<T> intf, Object impl)
Uses JsonSerializer.DEFAULT
and JsonParser.DEFAULT
for serializing and parsing by default.
intf
- The remote interface annotated with @RemoteResource
.impl
- The REST implementation bean or bean class annotated with @RestResource
.
public static <T> MockRemoteResource<T> create(Class<T> intf, Object impl, Marshall m)
Uses the serializer and parser defined on the specified marshall for serializing and parsing by default.
intf
- The remote interface annotated with @RemoteResource
.impl
- The REST implementation bean or bean class annotated with @RestResource
.
m
- The marshall to use for serializing and parsing the HTTP bodies.public static <T> MockRemoteResource<T> create(Class<T> intf, Object impl, Serializer s, Parser p)
Uses the serializer and parser defined on the specified marshall for serializing and parsing by default.
intf
- The remote interface annotated with @RemoteResource
.impl
- The REST implementation bean or bean class annotated with @RestResource
.
s
- The serializer to use for serializing request bodies.
p
- The parser to use for parsing response bodies.
public T build()
public static <T> T build(Class<T> intf, Object impl)
Uses JsonSerializer.DEFAULT
and JsonParser.DEFAULT
for serializing and parsing by default.
Equivalent to calling the following:
MockRemoteResource.
intf
- The remote interface annotated with @RemoteResource
.impl
- The REST implementation bean or bean class annotated with @RestResource
.
public static <T> T build(Class<T> intf, Object impl, Marshall m)
Uses the serializer and parser defined on the specified marshall for serializing and parsing by default.
Equivalent to calling the following:
MockRemoteResource.
intf
- The remote interface annotated with @RemoteResource
.impl
- The REST implementation bean or bean class annotated with @RestResource
.
m
- The marshall to use for serializing request bodies and parsing response bodies.
public static <T> T build(Class<T> intf, Object impl, Serializer s, Parser p)
Uses the specified serializer and parser for serializing and parsing by default.
Equivalent to calling the following:
MockRemoteResource.
intf
- The remote interface annotated with @RemoteResource
.impl
- The REST implementation bean or bean class annotated with @RestResource
.
s
- The serializer to use for serializing request bodies.
p
- The parser to use for parsing response bodies.
public MockRemoteResource<T> debug()
public MockRemoteResource<T> header(String name, Object value)
name
- The header name.value
- The header value.
public MockRemoteResource<T> headers(Map<String,Object> value)
value
- The header values.
public MockRemoteResource<T> accept(String value)
value
- The public MockRemoteResource<T> contentType(String value)
value
- The public MockRemoteResource<T> json()
public MockRemoteResource<T> simpleJson()
public MockRemoteResource<T> xml()
public MockRemoteResource<T> html()
public MockRemoteResource<T> plainText()
public MockRemoteResource<T> msgpack()
public MockRemoteResource<T> uon()
public MockRemoteResource<T> urlEnc()
public MockRemoteResource<T> openapi()
public MockRemoteResource<T> marshall(Marshall value)
Marshall
with this client.
This is shorthand for calling
value
- The marshall to use for serializing and parsing HTTP bodies.
public MockRemoteResource<T> serializer(Serializer value)
Serializer
with this client.value
- The serializer to use for serializing HTTP bodies.
public MockRemoteResource<T> parser(Parser value)
Parser
with this client.value
- The parser to use for parsing HTTP bodies.
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.