You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-34Lines changed: 32 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ The `RequestMethod` annotation is used to associate a service method with an HTT
48
48
Multiple methods may be associated with the same verb and path. `WebService` selects the best method to execute based on the provided argument values. For example, the following service class implements some simple addition operations:
@@ -109,7 +109,7 @@ Missing or `null` values are automatically converted to `0` or `false` for primi
109
109
`URL` and `List<URL>` arguments represent file uploads. They may be used only with `POST` requests submitted using the multi-part form data encoding. For example:
The first version automatically deserializes a successful server response using `JSONDecoder`, which is discussed in more detail below. The second allows a caller to provide a custom response handler. `ResponseHandler` is a functional interface that is defined as follows:
302
+
The first version automatically deserializes a successful server response using `JSONDecoder`, which is discussed in more detail later. The second allows a caller to provide a custom response handler. `ResponseHandler` is a functional interface that is defined as follows:
305
303
306
304
```java
307
305
publicinterfaceResponseHandler<T> {
@@ -314,22 +312,22 @@ If a service returns an error response, a `WebServiceException` will be thrown.
314
312
The following code snippet demonstrates how `WebServiceProxy` might be used to access the operations of the simple math service discussed earlier. `listOf()`, `mapOf()`, and `entry()` are static utility methods provided by the `org.httprpc.util.Collections` class that can be used to declaratively create immutable collection instances:
@@ -364,7 +362,7 @@ public interface MathService {
364
362
This code uses the `adapt()` method to create an instance of `MathService`, then invokes the `getSum()` method on the returned instance. The results are identical to the previous example:
System.out.println(String.format("%s has %d days", month.get("name"), month.get("days")));
493
491
}
494
492
```
@@ -503,7 +501,7 @@ public TemplateEncoder(URL url) { ... }
503
501
public TemplateEncoder(URL url, Charset charset) { ... }
504
502
```
505
503
506
-
The first argument specifies the URL of the template document (for example, as a resource on the application's classpath). The escape modifier corresponding to the document's extension (if any) will be applied by default. The optional second argument represents the character encoding used by the template document. If unspecified, UTF-8 is assumed.
504
+
The first argument specifies the URL of the template document (typically as a resource on the application's classpath). The escape modifier corresponding to the document's extension (if any) will be applied by default. The optional second argument represents the character encoding used by the template document. If unspecified, UTF-8 is assumed.
507
505
508
506
Templates are applied using one of the following methods:
@@ -645,6 +644,8 @@ producing the following result:
645
644
}
646
645
```
647
646
647
+
Note that the order in which properties are traversed is not guaranteed to match the order in which the accessor methods are declared in a class. This is because the JDK itself makes no guarantees about the order in which methods are returned by `Class#getMethods()`, which is used internally by `BeanAdapter` to identify accessor methods.
648
+
648
649
### Excluding Values
649
650
Any property tagged with the `Ignore` annotation will be excluded from the map. For example:
650
651
@@ -686,11 +687,15 @@ public interface TreeNode {
686
687
the `adapt()` method can be used to model the JSON data from the previous section as a collection of `TreeNode` values:
Similarly, when a proxy instance of this interface is created by the `adapt()` method, `getFirstName()` will return the value associated with "first_name" in the underlying map, not "firstName":
717
722
718
-
```
723
+
```java
719
724
publicinterfacePerson {
720
725
@Key("first_name")
721
726
StringgetFirstName();
@@ -737,7 +742,7 @@ For example, the following code could be used to serialize the results of a data
0 commit comments