Class ConstructUtil
- java.lang.Object
-
- net.officefloor.frame.impl.construct.util.ConstructUtil
-
public class ConstructUtil extends java.lang.ObjectUtility class to aid in construction of theOfficeFloor.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ManagedFunctionMetaData<?,?>getFunctionMetaData(ManagedFunctionReference functionReference, ManagedFunctionLocator functionLocator, OfficeFloorIssues issues, OfficeFloorIssues.AssetType assetType, java.lang.String assetName, java.lang.String forItemDescription)Obtains theManagedFunctionMetaDatareporting any failure to find to theOfficeFloorIssues.static booleanisBlank(java.lang.String value)Indicates whether the inputStringis eithernullor empty.static FlowMetaDatanewFlowMetaData(ManagedFunctionMetaData<?,?> functionMetaData, boolean isSpawnThreadState)Creates a newFlowMetaData.static <T,E>
TnewInstance(java.lang.Class<T> clazz, java.lang.Class<E> expectedType, java.lang.String creatingAssetName, OfficeFloorIssues.AssetType assetType, java.lang.String assetName, OfficeFloorIssues issues)Constructs a new instance of the inputClassby its default constructor.static <T> T[]toArray(java.util.List<T> list, java.lang.Object[] type)Convenience method forList.toArray(Object[])to pass compiler warnings for generic typed array.static <O> O[]toArray(java.util.Map<java.lang.Integer,? extends O> map, java.lang.Object[] type)Transforms the inputMapinto an array by thetypefrom indexes of theMap.
-
-
-
Method Detail
-
isBlank
public static boolean isBlank(java.lang.String value)
Indicates whether the inputStringis eithernullor empty.- Parameters:
value- Value to check.- Returns:
trueif blank.
-
newInstance
public static <T,E> T newInstance(java.lang.Class<T> clazz, java.lang.Class<E> expectedType, java.lang.String creatingAssetName, OfficeFloorIssues.AssetType assetType, java.lang.String assetName, OfficeFloorIssues issues)Constructs a new instance of the inputClassby its default constructor. If fails to instantiate, then reports issue viaOfficeFloorIssues.- Type Parameters:
T- Type of object to instantiate.E- Expected type that object is assignable.- Parameters:
clazz-Classto instantiate.expectedType- Expected type that is to be instantiated.creatingAssetName- Name of theAssetbeing created.assetType-OfficeFloorIssues.AssetType.assetName- Name ofOfficeFloorIssues.AssetType.issues-OfficeFloorIssues.- Returns:
- New instance or
nullif not able to instantiate.
-
toArray
public static <O> O[] toArray(java.util.Map<java.lang.Integer,? extends O> map, java.lang.Object[] type)Transforms the inputMapinto an array by thetypefrom indexes of theMap.- Type Parameters:
O- Element type.- Parameters:
map-Mapto be transformed into an array.type- Type of the array.- Returns:
Mapcontents as an array.
-
toArray
public static <T> T[] toArray(java.util.List<T> list, java.lang.Object[] type)Convenience method forList.toArray(Object[])to pass compiler warnings for generic typed array.- Type Parameters:
T- Element type.- Parameters:
list- List to transform into an array.type- Type of the array.- Returns:
- List as an array.
-
getFunctionMetaData
public static ManagedFunctionMetaData<?,?> getFunctionMetaData(ManagedFunctionReference functionReference, ManagedFunctionLocator functionLocator, OfficeFloorIssues issues, OfficeFloorIssues.AssetType assetType, java.lang.String assetName, java.lang.String forItemDescription)
Obtains theManagedFunctionMetaDatareporting any failure to find to theOfficeFloorIssues.- Parameters:
functionReference-ManagedFunctionReference.functionLocator-ManagedFunctionLocatorto use to locate theManagedFunctionMetaData.issues-OfficeFloorIssues.assetType-OfficeFloorIssues.AssetTypefor reporting issues.assetName-Assetname for reporting issues.forItemDescription- Description after "for" indicating what theManagedFunctionMetaDatais for.- Returns:
ManagedFunctionMetaDataornullif not found with issues reported to theOfficeFloorIssues.
-
newFlowMetaData
public static FlowMetaData newFlowMetaData(ManagedFunctionMetaData<?,?> functionMetaData, boolean isSpawnThreadState)
Creates a new
FlowMetaData.This provides generic type safe creation.
- Parameters:
functionMetaData-ManagedFunctionMetaData.isSpawnThreadState-trueforFlowto spawn aThreadState.- Returns:
- New
FlowMetaData.
-
-