Skip to content

Commit db2ac42

Browse files
authored
mark step without StepContext deprecated (#176)
1 parent 1155a10 commit db2ac42

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

sdk/src/main/java/software/amazon/lambda/durable/DurableContext.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,37 +139,50 @@ public <T> DurableFuture<T> stepAsync(
139139
return operation;
140140
}
141141

142+
/** @deprecated use the variants accepting StepContext instead */
142143
public <T> T step(String name, Class<T> resultType, Supplier<T> func) {
143-
return step(name, TypeToken.get(resultType), func, StepConfig.builder().build());
144+
return stepAsync(
145+
name,
146+
TypeToken.get(resultType),
147+
func,
148+
StepConfig.builder().build())
149+
.get();
144150
}
145151

152+
/** @deprecated use the variants accepting StepContext instead */
146153
public <T> T step(String name, Class<T> resultType, Supplier<T> func, StepConfig config) {
147154
// Simply delegate to stepAsync and block on the result
148-
return stepAsync(name, resultType, func, config).get();
155+
return stepAsync(name, TypeToken.get(resultType), func, config).get();
149156
}
150157

158+
/** @deprecated use the variants accepting StepContext instead */
151159
public <T> T step(String name, TypeToken<T> typeToken, Supplier<T> func) {
152-
return step(name, typeToken, func, StepConfig.builder().build());
160+
return stepAsync(name, typeToken, func, StepConfig.builder().build()).get();
153161
}
154162

163+
/** @deprecated use the variants accepting StepContext instead */
155164
public <T> T step(String name, TypeToken<T> typeToken, Supplier<T> func, StepConfig config) {
156165
// Simply delegate to stepAsync and block on the result
157166
return stepAsync(name, typeToken, func, config).get();
158167
}
159168

169+
/** @deprecated use the variants accepting StepContext instead */
160170
public <T> DurableFuture<T> stepAsync(String name, Class<T> resultType, Supplier<T> func) {
161171
return stepAsync(
162172
name, TypeToken.get(resultType), func, StepConfig.builder().build());
163173
}
164174

175+
/** @deprecated use the variants accepting StepContext instead */
165176
public <T> DurableFuture<T> stepAsync(String name, Class<T> resultType, Supplier<T> func, StepConfig config) {
166177
return stepAsync(name, TypeToken.get(resultType), func, config);
167178
}
168179

180+
/** @deprecated use the variants accepting StepContext instead */
169181
public <T> DurableFuture<T> stepAsync(String name, TypeToken<T> typeToken, Supplier<T> func) {
170182
return stepAsync(name, typeToken, func, StepConfig.builder().build());
171183
}
172184

185+
/** @deprecated use the variants accepting StepContext instead */
173186
public <T> DurableFuture<T> stepAsync(String name, TypeToken<T> typeToken, Supplier<T> func, StepConfig config) {
174187
return stepAsync(name, typeToken, stepContext -> func.get(), config);
175188
}
@@ -201,7 +214,7 @@ public <T, U> T invoke(String name, String functionName, U payload, Class<T> res
201214
name,
202215
functionName,
203216
payload,
204-
resultType,
217+
TypeToken.get(resultType),
205218
InvokeConfig.builder().build())
206219
.get();
207220
}
@@ -278,7 +291,8 @@ public <T> DurableCallbackFuture<T> createCallback(String name, TypeToken<T> typ
278291
}
279292

280293
public <T> DurableCallbackFuture<T> createCallback(String name, Class<T> resultType) {
281-
return createCallback(name, resultType, CallbackConfig.builder().build());
294+
return createCallback(
295+
name, TypeToken.get(resultType), CallbackConfig.builder().build());
282296
}
283297

284298
public <T> DurableCallbackFuture<T> createCallback(String name, TypeToken<T> typeToken, CallbackConfig config) {

0 commit comments

Comments
 (0)