Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use the new fluid API

  • Loading branch information...
commit 8b0728474972f383f281cf0f2393678c6e395747 1 parent 38bea2e
Jeanfrancois Arcand authored June 09, 2011

Showing 1 changed file with 10 additions and 8 deletions. Show diff stats Hide diff stats

  1. 18  README.md
18  README.md
Source Rendered
@@ -184,8 +184,8 @@ You can also generate ServiceDefinition on the fly from any POJO object. Let's s
184 184
 
185 185
 You can generate a ServiceDefinition by doing:
186 186
 
187  
-    MethodBasedServiceDefinitionCreator creator = new MethodBasedServiceDefinitionCreator();
188  
-    ServiceDefinition serviceDefinition = creator.create(AddressBook.class);
  187
+    MethodServiceDefinitionBuilder serviceDefinitionBuilder = new MethodServiceDefinitionBuilder();
  188
+    ServiceDefinition serviceDefinition = serviceDefinitionBuilder.type(AddressBook.class).build();
189 189
 
190 190
 The ServiceDefinition will be generated using the following template:
191 191
 
@@ -196,13 +196,15 @@ The ServiceDefinition will be generated using the following template:
196 196
 
197 197
 You can customize the method to HTTP method operation
198 198
 
199  
-    MethodBasedServiceDefinitionCreator creator = new MethodBasedServiceDefinitionCreator();
200  
-    ServiceDefinitionCreatorConfig config = new ServiceDefinitionCreatorConfig();
  199
+    import static org.sonatype.restsimple.creator.ServiceDefinitionCreatorConfig.METHOD;
  200
+    import static org.sonatype.restsimple.creator.ServiceDefinitionCreatorConfig.config;
  201
+    ....
201 202
 
202  
-    config.addMethodMapper(new ServiceDefinitionCreatorConfig.MethodMapper("foo", ServiceDefinitionCreatorConfig.METHOD.POST))
203  
-          .addMethodMapper(new ServiceDefinitionCreatorConfig.MethodMapper("bar", ServiceDefinitionCreatorConfig.METHOD.GET))
204  
-          .addMethodMapper(new ServiceDefinitionCreatorConfig.MethodMapper("pong", ServiceDefinitionCreatorConfig.METHOD.DELETE));
205  
-    serviceDefinition = creator.create(AddressFooBook.class, config);
  203
+    MethodServiceDefinitionBuilder serviceDefinitionBuilder = new MethodServiceDefinitionBuilder();
  204
+    ServiceDefinition serviceDefinition =
  205
+         serviceDefinitionBuilder.type(AddressFooBook.class).config(config().map("foo", METHOD.POST)
  206
+                                                                            .map("bar", METHOD.GET)
  207
+                                                                            .map("pong", METHOD.DELETE)).build();
206 208
 
207 209
 Hence a method starting with foo will be mapped to a POST operation etc.
208 210
 

0 notes on commit 8b07284

Please sign in to comment.
Something went wrong with that request. Please try again.