Class ConstructUtil


  • public class ConstructUtil
    extends java.lang.Object
    Utility class to aid in construction of the OfficeFloor.
    Author:
    Daniel Sagenschneider
    • Method Detail

      • isBlank

        public static boolean isBlank​(java.lang.String value)
        Indicates whether the input String is either null 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 input Class by its default constructor. If fails to instantiate, then reports issue via OfficeFloorIssues.
        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 the Asset being created.
        assetType - OfficeFloorIssues.AssetType.
        assetName - Name of OfficeFloorIssues.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 input Map into an array by the type from indexes of the Map.
        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 for List.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.