refactor code
This commit is contained in:
Родитель
38543ca2b9
Коммит
01d22d0b98
|
@ -3,21 +3,20 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for
|
||||
* license information.
|
||||
*/
|
||||
package com.microsoft.azure.functions.middleware;
|
||||
|
||||
import com.microsoft.azure.functions.internal.MiddlewareContext;
|
||||
package com.microsoft.azure.functions.internal.spi.middleware;
|
||||
|
||||
/**
|
||||
* This interface is implemented by middlewares to include middleware core logics.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* <p>This class is internal and is hence not for public use at this time. Its APIs are unstable and can change
|
||||
* at any time.
|
||||
*/
|
||||
public interface FunctionWorkerMiddleware {
|
||||
public interface Middleware {
|
||||
/**
|
||||
* Middlewares will override this method to include their own logics.
|
||||
* @param context execution context that pass along middleware chain
|
||||
* @param next function middleware chain {@link FunctionMiddlewareChain}
|
||||
* @param chain middleware chain {@link MiddlewareChain}
|
||||
* @throws Exception any exception that is thrown out in next middleware
|
||||
*/
|
||||
void invoke(MiddlewareContext context, FunctionMiddlewareChain next) throws Exception;
|
||||
void invoke(MiddlewareContext context, MiddlewareChain chain) throws Exception;
|
||||
}
|
|
@ -3,18 +3,17 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for
|
||||
* license information.
|
||||
*/
|
||||
package com.microsoft.azure.functions.middleware;
|
||||
|
||||
import com.microsoft.azure.functions.internal.MiddlewareContext;
|
||||
package com.microsoft.azure.functions.internal.spi.middleware;
|
||||
|
||||
/**
|
||||
* The function middleware chain.
|
||||
* The middleware chain.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* <p>This class is internal and is hence not for public use at this time. Its APIs are unstable and can change
|
||||
* at any time.
|
||||
*/
|
||||
public interface FunctionMiddlewareChain {
|
||||
public interface MiddlewareChain {
|
||||
/**
|
||||
* Invokes next middleware, usually used at the end of middleware to invoke next middleware in the middleware chain.
|
||||
* Invokes next middleware in the chain.
|
||||
* @param context execution context that pass along middleware chain
|
||||
* @throws Exception any exception that happen along middleware chain
|
||||
*/
|
|
@ -4,16 +4,14 @@
|
|||
* license information.
|
||||
*/
|
||||
|
||||
package com.microsoft.azure.functions.internal;
|
||||
package com.microsoft.azure.functions.internal.spi.middleware;
|
||||
|
||||
import com.microsoft.azure.functions.ExecutionContext;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Middleware Execution Context
|
||||
*
|
||||
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
|
||||
* <p>This class is internal and is hence not for public use at this time. Its APIs are unstable and can change
|
||||
* at any time.
|
||||
*/
|
||||
public interface MiddlewareContext extends ExecutionContext {
|
||||
|
@ -23,7 +21,8 @@ public interface MiddlewareContext extends ExecutionContext {
|
|||
* @param annotationSimpleClassName the simple class name of target annotation
|
||||
* @return the name of parameter defined in customer function
|
||||
*/
|
||||
Optional<String> getParameterName(String annotationSimpleClassName);
|
||||
//TODO: @Nullable
|
||||
String getParameterName(String annotationSimpleClassName);
|
||||
|
||||
/**
|
||||
* Returns corresponding parameter value sent from host by the given the parameter name.
|
||||
|
@ -33,6 +32,7 @@ public interface MiddlewareContext extends ExecutionContext {
|
|||
* @param name the name of parameter
|
||||
* @return an object which will be String type that represents parameter value of customer function
|
||||
*/
|
||||
//TODO: @Nullable
|
||||
Object getParameterValue(String name);
|
||||
|
||||
/**
|
||||
|
@ -47,6 +47,7 @@ public interface MiddlewareContext extends ExecutionContext {
|
|||
* Returns the return value from customer function invocation.
|
||||
* @return an object that is the return value of customer function
|
||||
*/
|
||||
//TODO: @Nullable
|
||||
Object getReturnValue();
|
||||
|
||||
/**
|
|
@ -3,20 +3,20 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for
|
||||
* license information.
|
||||
*/
|
||||
package com.microsoft.azure.functions.dihook;
|
||||
package com.microsoft.azure.functions.spi.inject;
|
||||
|
||||
/**
|
||||
* The instance factory that used by DI framework to initialize function instance.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
public interface FunctionInstanceFactory {
|
||||
public interface FunctionInstanceInjector {
|
||||
/**
|
||||
* This method is used by DI framework to initialize DI container. This method takes in the customer class and return
|
||||
* an instance create by the DI framework, later customer function will be invoked base on this class instance.
|
||||
* an instance create by the DI framework, later customer functions will be invoked on this class instance.
|
||||
* @param functionClass the class that contains customer functions
|
||||
* @param <T> customer functions class type
|
||||
* @return the function instance that will be invoked on by azure functions java worker
|
||||
* @return the instance that will be invoked on by azure functions java worker
|
||||
* @throws Exception any exception that is thrown out during DI framework create instance of function class
|
||||
*/
|
||||
<T> T getInstance(Class<T> functionClass) throws Exception;
|
Загрузка…
Ссылка в новой задаче