Skip to content

Commit ea8339c

Browse files
committed
DATAGEODE-302 - Edit chapter on Function Annotations.
1 parent 31ef572 commit ea8339c

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/main/asciidoc/reference/function-annotations.adoc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ focus on core POJO programming and business logic. To this end, {sdg-name} intro
1919
register the public methods of a POJO class as {data-store-name} Functions along with the ability to invoke registered
2020
Functions (including remotely) by using annotated interfaces.
2121

22+
[[function-implementation-execution]]
2223
== Implementation Versus Execution
2324

2425
There are two separate concerns to address: implementation and execution.
@@ -96,6 +97,7 @@ The Region data should normally be defined as a `Map`, to facilitate unit testin
9697
if necessary. As shown in the preceding example, it is also valid to pass the `FunctionContext` itself
9798
or the `ResultSender` if you need to control over how the results are returned to the client.
9899

100+
[[function-implementation-annotations]]
99101
=== Annotations for Function Implementation
100102

101103
The following example shows how {sdg-acronym}'s Function annotations are used to expose POJO methods
@@ -159,6 +161,7 @@ The `PojoFunctionWrapper` implements {data-store-name}'s `Function` interface, b
159161
the target method in its `execute()` method. It also sends the method's return value back to the caller
160162
by using the `ResultSender`.
161163

164+
[[function-implementation-batching-results]]
162165
=== Batching Results
163166

164167
If the return type is an array or `Collection`, then some consideration must be given to how the results are returned.
@@ -170,6 +173,7 @@ TIP: If you need more control of the `ResultSender`, especially if the method it
170173
to create the `Collection`, you can pass in the `ResultSender` or access it through the `FunctionContext`
171174
and use it directly within the method to sends results back to the caller.
172175

176+
[[function-implementation-annotations-enabling]]
173177
=== Enabling Annotation Processing
174178

175179
In accordance with Spring standards, you must explicitly activate annotation processing for `@GemfireFunction`
@@ -202,6 +206,7 @@ Thus, some of the configuration and concepts should be familiar.
202206
Generally, a single interface definition maps to multiple Function executions, one corresponding to each method
203207
defined in the interface.
204208

209+
[[function-execution-annotations]]
205210
=== Annotations for Function Execution
206211

207212
To support client-side Function execution, the following {sdg-acronym} Function annotations are provided: `@OnRegion`,
@@ -236,6 +241,7 @@ public interface FunctionExecution {
236241
By default, the Function ID is the simple (unqualified) method name. The `@FunctionId` annotation can be used
237242
to bind this invocation to a different Function ID.
238243

244+
[[function-execution-annotations-enabling]]
239245
=== Enabling Annotation Processing
240246

241247
The client-side uses Spring's classpath component scanning capability to discover annotated interfaces. To enable
@@ -367,15 +373,15 @@ as follows:
367373

368374
[source,xml]
369375
----
370-
<gfe:cache ... pdx-read-serialized="true"/>
376+
<gfe:cache pdx-read-serialized="true"/>
371377
----
372378

373379
Alternatively, you can set the `pdx-read-serialized` attribute to `true` for a {data-store-name} cache client application,
374380
as follows:
375381

376382
[source,xml]
377383
----
378-
<gfe:client-cache ... pdx-read-serialized="true"/>
384+
<gfe:client-cache pdx-read-serialized="true"/>
379385
----
380386

381387
Doing so causes all values read from the cache (that is, Regions) as well as information passed between client and servers
@@ -429,11 +435,11 @@ to the desired application domain object types defined by the Function method's
429435
However, this also requires you to explicitly register a {data-store-name} `PdxSerializer` on {data-store-name} servers
430436
where {sdg-name} Function-annotated POJOs are registered and used, as the following example shows:
431437

432-
[source,java]
438+
[source,xml]
433439
----
434440
<bean id="customPdxSerializer" class="x.y.z.gemfire.serialization.pdx.MyCustomPdxSerializer"/>
435441
436-
<gfe:cache ... pdx-serializer-ref="customPdxSerializeer" pdx-read-serialized="true"/>
442+
<gfe:cache pdx-serializer-ref="customPdxSerializeer" pdx-read-serialized="true"/>
437443
----
438444

439445
Alternatively, you can use {data-store-name}'s
@@ -447,8 +453,8 @@ or as one of {data-store-name}'s PDX types, as follows:
447453
[source,java]
448454
----
449455
@GemfireFunction
450-
public Object genericFunction(String value, Object domainObject, PdxInstanceEnum enum) {
451-
...
456+
public Object genericFunction(String value, Object domainObject, PdxInstanceEnum pdxEnum) {
457+
// ...
452458
}
453459
----
454460

0 commit comments

Comments
 (0)