文档管理中心

FunctionResult

展开

Interface Info

public interface FunctionResult

当函数执行成功后包含云函数执行结果的类。

Public Method Summary

展开

Qualifier and Type

Method Name and Description

String

getValue()

获取函数执行后的返回值,返回值为字符串类型。

<T> T

getValue(Class<T> valueClass) throws AGCFunctionException

获取函数执行后的返回值,匹配为传入的参数类。

Public Methods

getValue

展开

Method

public String getValue()

获取函数执行后的返回值,返回值为字符串类型。

Return

展开

Type

Description

String

函数执行后的返回值,返回值为字符串类型。

Sample Code
FunctionResult result;
String str = FunctionResult.getValue();

getValue

展开

Method

public <T> T getValue(Class<T> valueClass)

获取函数执行后的返回值,匹配为传入的参数类。

Parameters

展开

Name

Description

valueClass

开发者自定义的类对象。

Return

展开

Type

Description

<T> T

与开发者自定义的传参valueClass匹配后,返回的类对象。

Throws

展开

Exception Name

Exception Description

AGCFunctionException

Cloud Function异常基类。调用getValue(Class<T> valueClass),转换数据为自定义类失败时,会抛出异常。您必须显式地捕获并处理此异常。

Sample Code
try {
    FunctionResult result = function.call();
    Person person = result.getValue(Person.class);
} catch (AGCFunctionException e) {
    // ...
}

在 API参考 中进行搜索
请输入您想要搜索的关键词