Class MethodManagedFunctionBuilderUtil
- java.lang.Object
-
- net.officefloor.compile.test.managedfunction.clazz.MethodManagedFunctionBuilderUtil
-
public class MethodManagedFunctionBuilderUtil extends java.lang.ObjectUtility class for testing
MethodManagedFunctionBuilder.In particular, this is for ensuring extensions load and work as expected.
- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceMethodManagedFunctionBuilderUtil.ManagedFunctionContextBuilderBuilds theManagedFunctionContext.static interfaceMethodManagedFunctionBuilderUtil.ManagedFunctionFlowHandlerHandlesFlow.static classMethodManagedFunctionBuilderUtil.MethodResultResult of running theManagedFunction.
-
Constructor Summary
Constructors Constructor Description MethodManagedFunctionBuilderUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> ManagedFunctionType<Indexed,Indexed>buildMethod(java.lang.Class<T> clazz, java.util.function.Function<java.lang.Class<T>,java.lang.reflect.Method> methodFactory, MethodObjectFactory objectInstanceFactory, FunctionNamespaceBuilder expectedFunctionNamespaceType, java.lang.String... propertyNameValues)Builds theManagedFunctionType.static ManagedFunctionType<Indexed,Indexed>buildMethod(java.lang.Object instance, java.lang.String methodName, java.util.function.Consumer<ManagedFunctionTypeBuilder<Indexed,Indexed>> epectedTypeBuilder, java.lang.String... propertyNameValues)Convenience method to build theManagedFunctionType.static ManagedFunctionType<Indexed,Indexed>buildStaticMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.util.function.Consumer<ManagedFunctionTypeBuilder<Indexed,Indexed>> epectedTypeBuilder, java.lang.String... propertyNameValues)Convenience method to build theManagedFunctionType.static FunctionNamespaceBuildercreateManagedFunctionTypeBuilder()Creates theFunctionNamespaceBuilderto create the expectedFunctionNamespaceType.static FunctionNamespaceBuildercreateManagedFunctionTypeBuilder(java.lang.String functionName, java.util.function.Consumer<ManagedFunctionTypeBuilder<Indexed,Indexed>> decorator)Convenience method to create aFunctionNamespaceBuilderfor singleManagedFunctionType.static MethodObjectFactoryinstance(java.lang.Object object)Convenience means to createMethodObjectFactory.static <T> java.util.function.Function<java.lang.Class<T>,java.lang.reflect.Method>method(java.lang.String methodName)Convenience means to obtain theMethodfrom theClass.static MethodManagedFunctionBuilderUtil.MethodResultrunMethod(java.lang.Object instance, java.lang.String methodName, java.util.function.Consumer<ManagedFunctionTypeBuilder<Indexed,Indexed>> epectedTypeBuilder, java.util.function.Consumer<MethodManagedFunctionBuilderUtil.ManagedFunctionContextBuilder> contextBuilder, java.lang.String... propertyNameValues)Convenience method to build and run aManagedFunction.static MethodManagedFunctionBuilderUtil.MethodResultrunMethod(ManagedFunctionType<Indexed,Indexed> functionType, java.util.function.Consumer<MethodManagedFunctionBuilderUtil.ManagedFunctionContextBuilder> contextBuilder)Runs theManagedFunction.static MethodManagedFunctionBuilderUtil.MethodResultrunStaticMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.util.function.Consumer<ManagedFunctionTypeBuilder<Indexed,Indexed>> epectedTypeBuilder, java.util.function.Consumer<MethodManagedFunctionBuilderUtil.ManagedFunctionContextBuilder> contextBuilder, java.lang.String... propertyNameValues)Convenience method to build and run aManagedFunctionfor staticMethod.
-
-
-
Method Detail
-
createManagedFunctionTypeBuilder
public static FunctionNamespaceBuilder createManagedFunctionTypeBuilder()
Creates theFunctionNamespaceBuilderto create the expectedFunctionNamespaceType.- Returns:
FunctionNamespaceBuilderto build the expectedFunctionNamespaceType.
-
createManagedFunctionTypeBuilder
public static FunctionNamespaceBuilder createManagedFunctionTypeBuilder(java.lang.String functionName, java.util.function.Consumer<ManagedFunctionTypeBuilder<Indexed,Indexed>> decorator)
Convenience method to create aFunctionNamespaceBuilderfor singleManagedFunctionType.- Parameters:
functionName- Name ofManagedFunctionType.decorator- Optional decorator ofManagedFunctionTypeBuilder. May benull.- Returns:
FunctionNamespaceBuilder.
-
method
public static <T> java.util.function.Function<java.lang.Class<T>,java.lang.reflect.Method> method(java.lang.String methodName)
Convenience means to obtain theMethodfrom theClass.- Type Parameters:
T- Type ofClass.- Parameters:
methodName- Name ofMethod.- Returns:
Method.
-
instance
public static MethodObjectFactory instance(java.lang.Object object)
Convenience means to createMethodObjectFactory.- Parameters:
object- Instance.- Returns:
MethodObjectFactory.
-
buildMethod
public static ManagedFunctionType<Indexed,Indexed> buildMethod(java.lang.Object instance, java.lang.String methodName, java.util.function.Consumer<ManagedFunctionTypeBuilder<Indexed,Indexed>> epectedTypeBuilder, java.lang.String... propertyNameValues) throws java.lang.Exception
Convenience method to build theManagedFunctionType.- Parameters:
instance- Instance.methodName- Name ofMethod.epectedTypeBuilder- Builds expectedManagedFunctionType.propertyNameValues-Propertyname/value pairs.- Returns:
ManagedFunctionType.- Throws:
java.lang.Exception- If fails to build theManagedFunctionType.
-
buildStaticMethod
public static ManagedFunctionType<Indexed,Indexed> buildStaticMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.util.function.Consumer<ManagedFunctionTypeBuilder<Indexed,Indexed>> epectedTypeBuilder, java.lang.String... propertyNameValues) throws java.lang.Exception
Convenience method to build theManagedFunctionType.- Parameters:
clazz-Classcontaining the staticMethod.methodName- Name of the staticMethod.epectedTypeBuilder- Builds expectedManagedFunctionType.propertyNameValues-Propertyname/value pairs.- Returns:
ManagedFunctionType.- Throws:
java.lang.Exception- If fails to build theManagedFunctionType.
-
buildMethod
public static <T> ManagedFunctionType<Indexed,Indexed> buildMethod(java.lang.Class<T> clazz, java.util.function.Function<java.lang.Class<T>,java.lang.reflect.Method> methodFactory, MethodObjectFactory objectInstanceFactory, FunctionNamespaceBuilder expectedFunctionNamespaceType, java.lang.String... propertyNameValues) throws java.lang.Exception
Builds theManagedFunctionType.- Type Parameters:
T- Type ofClass.- Parameters:
clazz-Class.methodFactory- Factory to create theMethod.objectInstanceFactory-MethodObjectFactory.expectedFunctionNamespaceType- ExpectedFunctionNamespaceBuilder.propertyNameValues-Propertyname/value pairs.- Returns:
ManagedFunctionType.- Throws:
java.lang.Exception- If fails to build theManagedFunctionType.
-
runMethod
public static MethodManagedFunctionBuilderUtil.MethodResult runMethod(java.lang.Object instance, java.lang.String methodName, java.util.function.Consumer<ManagedFunctionTypeBuilder<Indexed,Indexed>> epectedTypeBuilder, java.util.function.Consumer<MethodManagedFunctionBuilderUtil.ManagedFunctionContextBuilder> contextBuilder, java.lang.String... propertyNameValues)
Convenience method to build and run aManagedFunction.- Parameters:
instance- Instance.methodName- Name ofMethod.epectedTypeBuilder- Builds expectedManagedFunctionType.contextBuilder- Builds up theManagedFunctionContext.propertyNameValues-Propertyname/value pairs.- Returns:
MethodManagedFunctionBuilderUtil.MethodResult.
-
runStaticMethod
public static MethodManagedFunctionBuilderUtil.MethodResult runStaticMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.util.function.Consumer<ManagedFunctionTypeBuilder<Indexed,Indexed>> epectedTypeBuilder, java.util.function.Consumer<MethodManagedFunctionBuilderUtil.ManagedFunctionContextBuilder> contextBuilder, java.lang.String... propertyNameValues)
Convenience method to build and run aManagedFunctionfor staticMethod.- Parameters:
clazz-Classcontaining the staticMethod.methodName- Name of the staticMethod.epectedTypeBuilder- Builds expectedManagedFunctionType.contextBuilder- Builds up theManagedFunctionContext.propertyNameValues-Propertyname/value pairs.- Returns:
MethodManagedFunctionBuilderUtil.MethodResult.
-
runMethod
public static MethodManagedFunctionBuilderUtil.MethodResult runMethod(ManagedFunctionType<Indexed,Indexed> functionType, java.util.function.Consumer<MethodManagedFunctionBuilderUtil.ManagedFunctionContextBuilder> contextBuilder) throws java.lang.Throwable
Runs theManagedFunction.- Parameters:
functionType-ManagedFunctionType.contextBuilder- Builds up theManagedFunctionContext.- Returns:
MethodManagedFunctionBuilderUtil.MethodResult.- Throws:
java.lang.Throwable- If fails to createManagedFunction.
-
-