Class ConstructUtil
- java.lang.Object
-
- net.officefloor.frame.impl.construct.util.ConstructUtil
-
public class ConstructUtil extends java.lang.Object
Utility 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 theManagedFunctionMetaData
reporting any failure to find to theOfficeFloorIssues
.static boolean
isBlank(java.lang.String value)
Indicates whether the inputString
is eithernull
or empty.static FlowMetaData
newFlowMetaData(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 inputClass
by 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 inputMap
into an array by thetype
from indexes of theMap
.
-
-
-
Method Detail
-
isBlank
public static boolean isBlank(java.lang.String value)
Indicates whether the inputString
is eithernull
or empty.- Parameters:
value
- Value to check.- Returns:
true
if 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 inputClass
by 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
-Class
to instantiate.expectedType
- Expected type that is to be instantiated.creatingAssetName
- Name of theAsset
being created.assetType
-OfficeFloorIssues.AssetType
.assetName
- Name ofOfficeFloorIssues.AssetType
.issues
-OfficeFloorIssues
.- Returns:
- New instance or
null
if 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 inputMap
into an array by thetype
from indexes of theMap
.- Type Parameters:
O
- Element type.- Parameters:
map
-Map
to be transformed into an array.type
- Type of the array.- Returns:
Map
contents 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 theManagedFunctionMetaData
reporting any failure to find to theOfficeFloorIssues
.- Parameters:
functionReference
-ManagedFunctionReference
.functionLocator
-ManagedFunctionLocator
to use to locate theManagedFunctionMetaData
.issues
-OfficeFloorIssues
.assetType
-OfficeFloorIssues.AssetType
for reporting issues.assetName
-Asset
name for reporting issues.forItemDescription
- Description after "for" indicating what theManagedFunctionMetaData
is for.- Returns:
ManagedFunctionMetaData
ornull
if 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
-true
forFlow
to spawn aThreadState
.- Returns:
- New
FlowMetaData
.
-
-