|
| 1 | +/** |
| 2 | + * Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 | + * Licensed under the MIT License. See License.txt in the project root for |
| 4 | + * license information. |
| 5 | + */ |
| 6 | + |
| 7 | +package com.microsoft.azure.functions.internal.spi.middleware; |
| 8 | + |
| 9 | +import com.microsoft.azure.functions.ExecutionContext; |
| 10 | + |
| 11 | +/** |
| 12 | + * Middleware Execution Context |
| 13 | + * |
| 14 | + * <p>This class is internal and is hence not for public use at this time. Its APIs are unstable and can change |
| 15 | + * at any time. |
| 16 | + */ |
| 17 | +public interface MiddlewareContext extends ExecutionContext { |
| 18 | + /** |
| 19 | + * Returns the name of parameter defined in customer function. |
| 20 | + * The input is the simple class name of target annotation. |
| 21 | + * @param annotationSimpleClassName the simple class name of target annotation |
| 22 | + * @return the name of parameter defined in customer function |
| 23 | + */ |
| 24 | + //TODO: @Nullable |
| 25 | + String getParameterName(String annotationSimpleClassName); |
| 26 | + |
| 27 | + /** |
| 28 | + * Returns corresponding parameter value sent from host by the given the parameter name. |
| 29 | + * The return type is Object but the real type is String (currently only support get String type, |
| 30 | + * planning to support other types in the future.) |
| 31 | + * Make it return Object to avoid break this API in the future. |
| 32 | + * @param name the name of parameter |
| 33 | + * @return an object which will be String type that represents parameter value of customer function |
| 34 | + */ |
| 35 | + //TODO: @Nullable |
| 36 | + Object getParameterValue(String name); |
| 37 | + |
| 38 | + /** |
| 39 | + * Updates the parameter value by parameter name. It will be the actual parameter value |
| 40 | + * used when invoke customer function. This API give middleware ability to update function input. |
| 41 | + * @param name the name of parameter to be updated |
| 42 | + * @param value the value of parameter to be updated |
| 43 | + */ |
| 44 | + void updateParameterValue(String name, Object value); |
| 45 | + |
| 46 | + /** |
| 47 | + * Returns the return value from customer function invocation. |
| 48 | + * @return an object that is the return value of customer function |
| 49 | + */ |
| 50 | + //TODO: @Nullable |
| 51 | + Object getReturnValue(); |
| 52 | + |
| 53 | + /** |
| 54 | + * Updates the return value from customer function invocation. |
| 55 | + * @param returnValue value that will be updated as function return value. |
| 56 | + */ |
| 57 | + void updateReturnValue(Object returnValue); |
| 58 | +} |
0 commit comments